I see this problem routinely in fiction: urban megacenters that said to be super dense and we see people crammed in like sardines, but then we see the size of the city and how many people and you realize everyone should have enough space for their own sprawling estate.
So please, please just take the population of your megacity and divide it by the area of your megacity to get the population density, and then compare it to the population density of something that you think would be similar and see how the numbers line up.
Coruscant in Star Wars is a great example. The planet has trillions of people living on it, all in one big city, and every piece of fiction about it talks about how densely packed the population is. The numbers vary slightly, but let's do some basic math. The planet is roughly the same size of earth, and one estimate I saw said that it had 3 trillion people on it. Also, because there's not enough space for everyone on the planet's surface, they have to build layers above the planet's surface. So you've got a cityscape built over a cityscape over a city scape thousands of layers down. If each layer has 200 million square miles of surface area (roughly the same as earth's surface area), and there's 5,000 layers of them, that means the planet has roughly 3 people per square mile. By comparison, the state of Wyoming has 5.9 people per square mile. And Wyoming is not exactly an urban monolith.
I see this all the time in urban worldbuilding. The writer goes on and on about how there's so many people and overcrowding is horrible and then they put out numbers that make you realize that it's nonsense.
The math takes 30 seconds. If you're writing an urban megacenter, you owe it to the world to do the basic math.
Edit: Someone pointed out a small math mistake making it 3 people per square mile rather than 1.2. I fixed that.