Everywhere has to fall within a county. Not so for cities. Thus, there are places where you can stand where you are not in a city.
City boundaries roughly follow population.
I’m not sure what determines county lines, possibly response time, e.g. your county fire department needs to be able to send a truck to your house in under x minutes.