For the dog scenario what I do is sort of dependent on how the dog walker responds as they approach. Sometimes people will reel in their dog and keep it close to them. In that scenario I tend to share the sidewalk as they pass. Their action gives me confidence they're doing what they need to to make sure their dog is likely not going to do anything. If they don't give any indication of doing something different as I approach I tend to give a wide berth to basically convey "I don't know what your dog is going to do."
As far as scaring people: If I'm coming up from behind I'll do something to make a noise. Cough. Land extra hard so my feet make a noise. Or if on gravel slide my feet more to make noise. If they have headphones on I'll give them a wide berth. Having to go into the street doesn't bother me at all. Of course I only do it if it's clear. If cars are around I'll wait.
Jim