I've taken my dog to reactivity training and they teach counterconditioning and the color zones method to help manage a dog's reactivity when out on walks or otherwise interacting with the outside world.
Your dog has three zones:
Green: safe, comfortable, relaxed
Yellow: beginning to fixate, may start tugging, growling, or whining
Red: loses control (no longer responds to commands)
Your goal is to keep him in the green zone as much as possible and eventually help increase his threshold around other dogs so that his yellow zone turns green, so to speak. You want to keep him out of his red zone as much as possible.
Once he's stopped responding to you and is completely fixated (and reacting) to the other dog, it's too late—that is his red zone, and you need to prevent him from entering that. You need to turn around and go another direction BEFORE he enters his red zone. So if you're on a walk, and your dog notices another dog (or squirrel or rabbit), you want to get his attention before he can begin to fixate. This is where you can give a command, then a treat. You are helping break his concentration on that other dog and you're reinforcing that seeing other dogs is not a bad thing. Also, by performing a command/trick, they can also shift that energy from the creature to their job. But your dog may escalate from green to yellow to red very quickly, in which case you need to turn around sooner rather than later. With time and practice, you will extend that threshold and be able to work more in that yellow zone to bring him back to green.
Other exercises to try include sitting near an area with other dogs coming and going, but not your front yard (his territory) or a dog park (too overwhelming). Keep treats available and remember to have different levels of treats that you can turn to when you need to really get his attention and regular kibble won't do. When a dog comes into view, speak calmly to your dog and give him a treat. Be sure to give him lots of praise for staying calm. If he gets out of control, take him inside. Start with just a few minutes every day, working into longer windows as he becomes comfortable. It's also recommended to not undo all that hard work of counterconditioning by letting your dog sit at a window where he can bark at creatures passing by unless you're there to do the counterconditioning exercises.
This takes work, but it's worth it in the long run for you and your dog. When you're out with your dog, you should work on
The trainer I went to and learned this from also wrote a book that he provides to all class participants, but it's also available on Amazon.