The Emergency U-turn (or "turn and go") is an excellent technique to get the heck outta Dodge when faced with something you / your dog doesn't want to deal with.
The U-Turn must be learned and practised before being put into action so that you can ensure that your dog will react predictably and avoid following the distraction. First, choose a verbal cue to associate with the U-Turn and make sure it doesn't sound anything like another cue that you use.
Ideas for cues: "this way", "watch out", "uh-oh", "danger", "let's go"
With your dog on leash, walk straight ahead at a regular pace and suddenly say your cue, pause for a beat, and then turn your body a full 180 degrees, pivoting on the spot, and take a few jogging steps in the new direction. "Bowl" a few treats onto the ground ahead of your dog in the new direction and ta-da! You've done a U-turn.
Be sure that you do not drag your dog or put pressure on the leash - this has to be a fun game - not one where they get yanked around! Use kissy noises and happy talk to get them to move along with you if you have to.
You may need it when being approached by a person or dog, when your dog is being reactive, when you see that really annoying neighbour or any other time you need to duck out and walk away quickly.