Think about what happens in a fireworks display. Essentially, the sky is black. Within the sky, a series of bright lights turn themselves on and then off in random places. The important thing to realise is that each firework is its own shutter! You need to set your ISO and aperture so that each firework's "natural shutter" results in a correct exposure of that firework. You can then leave the camera's shutter open for more or less as long as you want, and each firework that appears during that time will be added to the image, correctly exposed. If you leave the shutter open too long, multiple fireworks may go off in the same spot, which will over-expose.
I've found that something like f/11 and ISO-100 (fireworks are bright!) works well; if the fireworks are farther away, a wider aperture might be needed, as less of their light will be reaching you. Manual focus because you don't want the camera hunting trying to focus on the black sky, and the aperture's narrow enough, and the fireworks far enough away, that you'll have plenty of depth of field. Manual exposure mode, too. Tripod, of course.
If you're shooting fireworks just against the sky, use bulb mode, so you can start the exposure when something interesting is happening and stop when you think you've caught enough. If you're shooting with a foreground, choose whatever shutter speed gives a the exposure you want on that foreground – unfortunately, that means you can no longer choose how many fireworks you get in each shot. Make sure you figure out that exposure before the fireworks start.
Check the first few exposures, as you'll probably need to adjust.
If your initial guess of aperture and ISO were wrong for this fireworks display, you'll need to adjust to get them correctly exposed and you'll need to make the corresponding adjustment to the shutter speed so that the foreground exposure remains correct.
If the fireworks are illuminating the foreground enough, it will be over-exposed and you'll need to use a faster shutter.
If the fireworks are very intense, you might find that correct exposure of the foreground over-exposes the fireworks because more than one is going off in the same place of the image. In that case, you'll probably have to use a faster shutter to decrease the number of fireworks in each shot, so reducing the chance of them overlapping. Unfortunately, that will underexpose the foreground, though you can try to bring that up in post.
One helpful thing about fireworks is that you can get away with a certain amount of overexposure. They're bright, and they're bright colours, and a little overexposure will still look natural. A bit more overexposure might change the colour or even turn them white, but that can still look fine.