If I have an account on Mastodon.Social, and another account on PieFed.Social are they technically on the same instance, since they're both on .Social?
The cost of a (word).com domain can be tens of thousands of dollars if nobody owns it to millions of dollars if someone does. The cost of a (word).social domain is like $10.
You can register a second level domain (e.g. "google", "lemmy”, "cnn") with a specific TLD, resulting in a domain name (e.g. "google.com", "lemmy.social", "cnn.com")
The devout Christians currently going through a crisis on whether to go with "Jesus is in all of us, thus yes" or "Our boy J don't want none o' that nastiness".
Oh god... let's not get into the nuance of web hosting. Soon you'll have to explain dns or what a reverse proxy is... or heaven forbid how certificates work to secure it all.
If I have a house in Orange County, California, and another house in Orange County, Florida, do I technically only have one house since they're both in Orange County?
I mean, it communicates the same point. The two are unrelated even though they have the same county name, just like websites share the same TLD and are completely unrelated to each other.
Think of a URL and its dots like folders in your drive where each can have different files in each of them even if they have the same name as another folder.
They're just written in reverse order.
(Also a whole lot of other differences and other technical details on how to actually make the site work, but for your question we can just keep at this)
So, you have the social root folder (Top Level Domain) which contains many sub folders, one of them is mastodon and another is piefed.
Each have their own files to render their UI and process the requests they receive, but they don't talk to each other, even when they might have some files and requests with the same name.
The same way you have in your home folder your documents, pictures, videos, downloads, etc.
And yeah, they can go even deeper, my lemmy instance is lemmy.pe1uca.dev, not just lemmy.world like for this community.
I could have mastodon.pe1uca.dev if I'd like.
to a layman it's probably best to just.. not really think too deeply about this, there is layer upon layer of possible nuance and yet at the same time 99% of the time it's as simple as "if the 'thing.otherthing' isn't identical then they have absolutely nothing to do with each other".
To really understand what's going on you'll need to dive into how computer networking functions and a bunch of other things, which i do highly encourage since it's good to know, but the important thing here is that you're talking about domain names, which i'm not going to try to explain further but rather recommend you look up on wikipedia and other places to learn more about.
When it comes to identifying the server, hostname the first thing that counts. lemmy.world or mastodon.social or google.com are three different hostnames. At this point you can basically treat the period as no special character, it's just part of the funny world. This basically answers your question: those are two different domains, ie. for all purposes, different instances.
However, your computer does not really connect to hostname but to IP address, so the next important thing is to translate the hostname to an IP address.
Aside: a valid hostname does not even have to have period in it. For example, localhost is a valid hostname! But generally hostnames without periods don't get translated to any useful IP addresses. localhost is probably the only one widely used hostname but your OS will translate it to a special IP address which marks your own device.)
So to translate the hostname to IP address is done using so-called DNS. So before you can connect, your computer already knows an IP address of a DNS server, and asks it to translate the hostname to IP address. Technically, this is still not where the period is strictly important.
Where the period does start to be meaningful is when you think about: so we have billions of IP addresses, billions of hostnames, how do we organize it all? Who is going to maintain the huge massive list?
So it works like this: There are dozens of organizations, each of which is assigned one or more "top level domains" (TLD). Then they are responsible for maintaining lists of all hostnames ending with those domains. Many of these organizations are local to certain states. For example, in Czech Republic, where I live, we have organization called CZ.NIC which maintains all domains ending with .cz. So it's up to CZ.NIC how it manages permissions and gives out the domains. In this case, basically anyone can register any free domain ending with .cz, and what this registration means is that now they can get a server with an IP address, run whatever they want and have the registered domain name point to that IP address.
Note that other organizations may decide to add additional rules. For example .uk domains are managed with extra rules, where non-government (commercial) entities are normally allowed to register only .co.uk and other .uk names are not handed out easily. I don't actually know the details about .uk but my point is that if you are going to think about a hostname and how to begin to understand who owns it, first thing that matters is the TLD, and from that point the rules might be slightly different. To be fair, I haven't seen much variance between this; almost all public TLD's I've seen were either "simple", meaning myname.tld or this thing that UK does (also New Zealand, from the top of my head).
One almost universal rule is, though, that if I, say, register seznam.cz with CZ.NIC, then I automatically get not only seznam.cz but also any address I can possibly come up which ends with .seznam.cz. foo.seznam.cz, bar.seznam.cz, www.seznam.cz, I can now start organizing my servers using this whole infinite space, with any number of extra periods. I could totally start a business and start promoting my server foo.bar.baz.whatever.cz on billboards, as long as CZ.NIC grants me whatever.cz.
So back to your question: mastodon.social and piefed.social are two completely different domains. All we know that they have in common is that whoever registered them, had to deal with the same organization; that is whoever maintains .social.
So TL;DR: there's really nothing that suggests that they would be the same instance.