Most of the population lives in The City
If you had abundant energy and technology on the Earth and you are constrained to limit your resource usage to that of the Earth, the limit is at least greater than 7 billion people as you could simply put everyone in a single city and have all supplies shipped to that single city. With automation replacing all farmers, and other occupations that requires a physical presence today, everyone could live in that city. But without full automatization, farmers, miners, etc. that require a physical presence considerable distance away from the city, perhaps 10% of the population must live in the country.
The question then becomes how many people could Earth support with extensive use of hydroponic farming and artificial lighting, etc. - these technologies are currently used, they just do not dominate the market due to economics. Perhaps double or triple the current population is possible without breakthrough technology.
Since the most modern sewage plant can produce drinking water quality output, sewer and water is not going to be the ultimate bottleneck for city size and essentially all of the water can be recycled.
To get abundant energy with current technology able to support the entire population you need lots of nuclear power - renewables do not have the energy density to support such a city and you run into serious problems with wasted energy if you use seriously long transmission lines. Renewables will require significant numbers of maintenance people necessarily living in the country.
For a city of 7 billion people.
City Area: At NYC density, the area is 280,000 square miles. Slightly larger than Texas.
Sewage Plant Area 3,000 square miles (7125 times the area of Chicago's Stickney wastewater treatment plant that serves 2.4 million people).
Nuclear Power Area 60,000 square miles, 50 TW capacity (compared to 18 TW global energy use in all forms today) at 3. Cities are more efficient, but much of the world is in poverty. This is a lower-bound energy budget. 100 TW is more desirable
Renewable Power 1,500,000 square miles, 50 TW capacity -- this is simply impractical when you add in transmission losses and the material resources needed.
In reality, a better form of nuclear power would be very desirable for The City, but it would be possible with current technology, until you run out of uranium at least.
The land use for nuclear is based on current average usage. This could (and would) be reduced considerably if you had any serious intent of reducing land usage -- e.g., waste storage could grow vertically.
Thorium is more abundant than uranium and can actually be used in a CANDU reactor, so current nuclear tech level actually includes thorium, though a better reactor designed specifically for thorium would work much better. With reprocessing and breeding, the combined uranium and thorium reserves would last for thousands of years even if they supply the entire energy demand for the world. Breeding itself is probably best considered slightly future tech since it is only used commercially at 1 plant is Russia, arguably before the tech was ready for regular use.