Like 65er noted, there are dogs that pepper spray acts as an inspiration to violence. I've quit carrying it.
I've found that with very, very few exceptions that a firm order from a human will give most pursuing dogs (or waiting dogs) pause. And a blast of water (or whatever is in it) from your water bottle will also stop a dog.