Sharding
Sharding is something that happens in retail to stop the servers overloading. So if there are too many people in a particular zone they can divide them up, into different version of that same zone.
It’s also for WM on and off, so that people can choose whether they want to be in a PvP enabled version of the world or a PvE environment where the opposite faction isn’t hostile (unless you enter or get to close to one of their bases).
Sharding allows people to be stuck in the same area regardless of what realm they are from. So the world, theoretically always feels populated. It’s a cross realm zone effectively.
RP realms are kind of exempt, you can be invited into RP realms by players on them but they aren’t grouped with any others (unless they are connected realms).
Phasing
Phasing is where the world changes depending on what stage of a questline/storyline you are on. We also have different time phases from some zones. Like for example in the current storyline Teldrassil is destroyed but you can talk to Zidormi and go back to an older phase of the world where Teldrassil is still alive and well.
Another example is when a storyline changes the world around you. So someone who hasn’t completed a quest line wont see the world the same way as you do and you wont be able to see each other.
Layering
This is specific to Classic. It’s a method used to balance realms at busy times. Like Classic launches so more people can be connected and play at once. It is usually phased out over time or heavily reduced.
For TBC launch I think I was in layer 19 and our Dark Portal bugged and wouldn’t let anyone in, we had to get invited to other layers to get in
Over the first month, the layers dropped to five or less, and eventually they are just removed and the population is what you see around you.
Layering is realm specific and you wont see people from other realms.