Ask any child to draw a cat, and they will be sure not to forget the whiskers.
You might not notice whiskers so easily on a dog, but they are present, as indeed they are in many mammals, from mice to beavers to walruses.
Why all the whiskers?
Whiskers are not just body hair that has gotten excessively long, they are a whole different kind of hair follicle, much thicker and less flexible than fur. Nor do they occur just around the mouth. many mammals, such as house cats, have less obvious whiskers above their eyes, and sometimes between the digits of their paws.
The whisker itself is connected to a specific nerve pathway that runs all the way to the spatial processing center of the animal's brain. Minute observation of rodent brains, for example, has shown that there are very specified sites that respond when an individual whisker is touched.
This kind of evidence may have led you to guess already what whiskers are used for. They are sensing devices.
An animal such as a mouse needs to navigate small corridors in, say, your wall, the whiskers tell it how much space it has on either side of its head. The cat, sticking its nose into small crevices while seeking the mouse, is also alerted to its orientation with respect to the walls.
Think about how you put your hands out in front of you when walking in the dark. Whiskers do that same job, at a lesser distance, all the time.