You are right about the cities. They were almost always mixed. One of the reasons for the "mix" was frequently the ineligibility of some ethnic group or the other to own land ~ e.g. Jews.
At the same time city populations were a small fraction of the total population in any given area. They also had a "reproductive" problem. City people had a very low birth rate. Rural people had a high birth rate. Kids did not do well in towns.
More children = another hand to pick the crops/milk the cow/slaughter the swine.
Lets also forget that in urban areas, there are typically more diversions, which leads to a lower birth rate. The key reason given for the rapidly falling birthrate in Latin America since the end of WWII has been urbanization. In a rural area, your main form of activity has traditionally been farming and procreating. In an urban environment, there are more diversions, and additional children are usually a burden more than an additional source of labor/income.*
You are correct that in medieval times to early modern times, cities and towns were disease ridden and not healthy places.
*A major exception being our own cities when we had AFDC from the 1960s-1990s, where poor urban women were paid additional benefits on the amount of children they had.)