Yes, dogs and cats can sunburn too! As in humans, sunburn can cause pain and blistering, and raise the odds of skin cancer. Sunburn is a bigger risk for hairless animals and for animals (or parts of the body) with thin hair or white hair.
A few pet-friendly sunscreens do exist, however. Epi-Pet Sun Protector Sunscreen Spray is good for dogs. The options are fewer for cats, but animal-health company Virbac offers a cat-safe insecticide with sunblock.
Some human baby-safe sunscreens can maybe do the trick too, but be careful: some sunscreen chemicals are toxic to animals, especially if ingested. Research well and discuss with your vet.