Server and Client on one instance of a game

From a programming perspective, there isn’t a huge difference between a local server and a global server. The only difference is that you run a local server on your own computer, and you run a global server on a service like AWS or Google Cloud.

(You can also set your computer up as a global server, but that’s not really what you’re asking about.)

Start looking into server-side development, and start with a local server. That’s how you should start whether you’re planning on eventually implementing a global server or not.