So it may be helpful to take one illustrative example: Shanghai in China is very quickly approaching the 20 million mark. And understand, this is a vibrant booming metropolis. Not city core with enormous shanty town, periphery.
So how may people is 20 million?
A quick look at wiki notes that the United States has two States (California and Texas) that are larger than 20 million, and one (New York) that comes close. So Shanghai by itself would be our third largest state.
Shanghai at Night
For a very good sociological discussion of this I recommend: Super High Density Shanghai from Understanding Society.
They note that there is a very good arguments to be made for this type of mega-city, and that it is not necessarily dysfunctional at all.
Being a blog, to some extent, of limits rather than possibilities, it goes without saying that if you maximize for efficiency, you may have some problems down the road if inefficiency are imposed on the system.