I generally divide population by 12 to obtain domiciles, then add on 20% or so to obtain outbuildings of various sorts - barns, coups, silos, etc. Of course, a few of the buildings are going to be larger manor type dwellings, but I figure that sort of thing comes out in the wash. For every palace you make, there are probably a several buildings with few or no residents as well.
Exactly how you 'paint' those numbers depends on the style of city you are making. The current city the campaign is in is one of the 10 or so largest on the world at 140,000 inhabitants, but was originally founded by air genasi and so, long ago, before their empire collapsed had a large amount of flying technology. That technology is in decay, but the buildings and structure of the city still depends on it - it's one of the few places in the world with many residential buildings of more than 2 stories, and 7-10 story buildings aren't unknown. Many buildings have streets running over their roofs - streets seldom used any more because flying/levitating traffic is almost non-existent. All this creates an extremely high population density, and an increasing economic burden on the city that is part of the current stories subtext. The people need magic to continue to enjoy the lifestyle they are accustomed to, but they are running out of it and unable to repair what's getting broken.
That city looks nothing like a 'medieval' city.
For a more typical very large medieval city I might do a quite small dense urban center surrounded by a wall that was the original economic/political center, and then a patchwork of very closely spaced villages and hamlets extending about it for a mile or two in all directions with about 1/4 mile between 'villages' (16 little neighborhoods per square mile) and 60-80 buildings per village. That works out to about 10-11k people per square mile, not that different than some modern urban areas albeit with more 'yard' and less 'bedroom', and with about half the land still in some sort of cultivation. Outside the walls houses would have small garden plots, pig sties, small orchards, and so forth gradually being overtaken by less agrarian pursuits. I'd mess up the grid with a few small brooks and streams wandering around then gravitate nearby villages toward the streams, and line them with mills and mill ponds and the like, and add a major river or sea harbor. Keep in mind there is zero sanitation. The waste of all the people and their animals is flowing down the same stream that is used for washing, drinking, and powering the mills, although in medieval times this is somewhat mitigated by the fact that you've got this crop land sucking up manure everywhere. (Ironically, there are in medieval cities actually public baths, fed by springs or wells, were people can go to get clean water to bathe in. The medieval are generally cleaner than the early moderns, who didn't bathe - because all the baths get shut down by the black death and people don't start bathing again for 400 years or so.) Then I'd draw major roads between the villages, build an irregular grid around the intersections and sprinkle black squares everywhere, leaving a few big squares for churches, monasteries, and the like.
At this point in time, there is little distinction between 'place of business' and home. Economic production is centered in the home and distributed across the community, and businesses are generally in the home. The biggest factories/employers are probably also monasteries, which often have lots of both water power and man power. If you have a shop, you probably sleep above it or next to it in the same building. If you have employees, they probably sleep in the shop. Servants more or less sleep where they work - cook in the kitchen, stable boy in the barn, cinder wench by the fire place (which isn't all bad in the winter), maid outside the door to her ladies' chamber (in an antechamber or drawing room if she's lucky, in the hall if she isn't).
Beyond that zone we'd leave the city proper and thin out to one village every 2-4 miles with broader fields and pastures between them. Beyond that, we get truly rural, with villages spaced about every 8 miles - one days drive by ox cart. Big cities like that though would be importing food from not only a 30-40 mile radius, but probably by ship from around the world. Food production has been globalized a lot longer than is commonly realized. Rome for example couldn't feed itself without regularly wheat shipments from Egypt, and was really consuming excess crops from across the Empire - oil from Greece, salted fish and cured meat from Spain, etc.
As the things got less medieval, roads would get more paved, and the dense urban area would increasingly creep out around the old walls eating up the older medieval town.