All of a sudden, your reverie is shattered by a barking ball of fur and fangs and it is making a beeline for your unprotected legs. At best, your concentration has been broken and your pulse, already elevated by exercise, is now off the scale. You've probably heard that a dog can sense what you're feeling. If it's fear, the dog will get bolder, more agressive. My suggestion, if you have doggiephobia, is to stop running and walk briskly while giving the dog a wide berth.
Dogs are very territorial, and most canine encounters end at the property boundary.
If the dog ventures out into the road, face it as you continue walking. DON'T try to pet the dog. DON'T turn away and resume running. The former may be misinterpreted as a threatening gesture, and the latter will almost certainly be regarded as an attempt to escape. In most cases, the dog will either get bored with you and return home or decide you're a pal and run alongside you.