My approach to this sort of thing has always been to be proactive and not reactive. My goal is to socialize my dog to any and all opportunities that arise. In fact, I go looking for them, and the weirder the better.
This mindset helps me to keep a better handle on things. For instance, if I'm trying to teach one of my dogs to be calm around strangers and unfamiliar dogs, I would approach it in stages. If on one of my routine walks, I encounter somebody, we'll step a few feet off the sidewalk onto a driveway. Then I'll put the dog in a sit stay. That's his command, to remain in the sit despite what comes along. Next, I'll proactively tell the person who is approaching, "hey, I'm teaching my dog some manners, do me a favor and just keep on walking by." Well, that person now feels as though they are helping. You'd be surprised at the reaction. Frequently, they will straighten up, and very much in control of their dog (as if to show me what they can do), walk right on by. If my dog starts to squirm, I'll reinforce the sit command, not tell him to leave the other person and dog alone. His command is to sit, hence there is no conflict in his mind about other people and dogs being something he shouldn't engage. That will come later when he's ready. Over time, I'll work my dog up to meeting the stranger head on, and passing them, and eventually meeting them.
Another example of this is crossing the street. In our neighborhood, we don't have a lot of vehicle traffic. When approaching a corner where we need to cross the street, it would be easy to simply step into the street and keep walking to the other side. However, I always stop, and tell my dogs to wait and then sit. A lot of times approaching cars will stop or slow down, and wave me across. I always refuse, and wave them on. I'm in control, because I'm trying to teach my dogs to stay out of the street. They should only enter the street when I say it's okay. Having the dogs wait gives me the chance to scan all around to make sure it is safe to continue. Sometimes, we'll wait for a few minutes and let multiple cars pass. Now my dogs are socialized to a suburban environment of sidewalks and streets, and when they walk off leash, they don't step into the street. Not because they think it's bad, but because I haven't told them it's okay yet.
The point is, I maintain control (unless of course, it's some sort of situation that takes us by surprise). I don't let the other person control it, and I'll use the notion of teaching my dog as the means of conveying that. This requires you to keep your head up, and scanning for what's going on around you. It helps you to be confident too. When you are reacting to things, you get anxious. When you're anxious, your dog picks up on that, and invariably does exactly the opposite of what you'd like.
Greg