● I don't like to drive around the city. I prefer taking public transportation.
-- here - yes, you can. In fact "in" will be more appropriate. You could say "I don't like driving around the city", but it might mean "aimlessly driving around" in the city, which is not what you want to say here. Therefore, "I don't like driving in the city" might be a bit more clear.
● I got lost on the way to work. I was wandering around the city.
-- In this case "wandering around the city" also has this air of aimlessness. So in the context of getting completely lost and just walking around not knowing to turn, this might be a better place for "around the city". But, if there is "the city" as a specific portion title of a bigger area (like "the inner city" or the "old town" within the city), and you want to specify that you were wandering in that specific smaller area of the larger place, then you might actually say "I was wandering around in the city" - using both "around" and "in". In this case "wander around" is a verb-phrase with a slightly different meaning than just "to wander", so you can add a new proposition after it in reference to the specific place.