There are occasions that, for the safety of our dogs, muzzles should be used. What most people are unaware of is that there are two types of muzzles.
The basket muzzle allows your dog to drink, eat, and pant so they can cool themselves. These muzzles can be used for an extended period of time. The mesh muzzle depicted in the second photo should only be used for short periods of time. Fifteen minutes or less. This is due to the fact that the dog cannot pant with this type of muzzle. Dogs cool themselves by panting so the use of this type of muzzle for a long period puts your dog at risk of overheating. Especially is your dog is injured or sick.
Muzzles should be used anytime you feel your dog may lash out at a human or another animal. This could be due to them being injured or being placed in an overly stressful situation. An injured animal may lash out due to pain. Their first concern during this time is to protect themselves. We would react the same if someone started to take ahold of our broken arm. We would grab them to stop them from touching our injury. Dogs only have their mouths to defend themselves and so their are teeth involved.
If a dog is put into a highly stressful situation they can become unpredictable. They also have a fight or flight instinct just like us. If they are on a leash and cannot move away from a situation they may lash out due to fear. When your dog is put into a situation they have never been in, it can cause undo stress. This may be where there are several dogs they are not familiar with. Or, where there are lots of people milling around them closely and reaching out to touch them.
A muzzle is a safe way for us to protect our animal and others. It is much better to use a muzzle rather than deal with someone who has been bitten by our dog. That can cause a situation that spirals out of control with law enforcement becoming involved. Muzzles should not be viewed as an indication that an animal is vicious. These are aids we use to protect ourselves and our animals.