Stay with them. Don’t leave them in the back yard or house while you go out front, or drive off, to enjoy the fireworks. I have spent many July 4ths indoors, holding and reassuring my dog (and for several years my dog AND my scared young son).
Get your dog a Thundershirt. This fits like a straitjacket, while not impairing movement. Help your dog feel contained and snug. If it’s too late to run to the pet store for this, wrap your dog in a towel.
Plan a little ahead, and talk with your veterinarian’s office about medication. There are two main approaches: Sedatives, which leave a dog scared inside, but droopy and lethargic, less able to react to the loud noise; or anti-anxiety medication, which helps ease the fear of the next unknown BANG. Which works better is up to you and your dog; situations differ.
Best yet, take your dog somewhere without fireworks. Go camping. Go stay in a motel in a very rural area. Go stay at the beach, with the white noise of crashing surf to mask the noises.
Cats? They don’t let us know if the noise bothers them.