What would happen if everyone on Earth lived in one city? To get an idea, you have to look at the world's biggest and densest cities, like Tokyo. The greatest population density ever recorded was in the Kowloon Walled City in Hong Kong, where people were living at a density of 1.2 million per square kilometer. But you can fit everyone on Earth into one city without it looking like that, it just has to be a city the size of a whole country.
Using real-life numbers as a reference point, this video from RealLifeLore explains how big a city that fits the whole world's population would be, depending on how dense it is. It's surprising how quickly it shrinks down. If everyone in the world lived in a city the density of Chicago, for instance, the city would only need to be as big as Iran in order to fit us all. But though that would leave a lot of wide open spaces, being that close to everyone all the time sounds pretty hellish, even if you aren't in Kowloon-style conditions.