A lot of drivers sit far too close to the vehicle in front. It probably never occurs to them just how dangerous this can be, and they may feel justified in doing it if they are late or they feel the vehicle in front is going too slow.
Following too close reduces the time available to react to things the person in front does. Thus it raises the chance of a rear-end collision.
Three seconds is the absolute minimum recommended following distance. Remember that three seconds will be much further if traveling at higher speeds than if you are traveling slowly.
Drivers need to extend the gap when the weather could make it harder to notice what the person in front does, such as in heavy fog, driving snow or rain.
They also need to sit further back when the road surface has reduced traction, and braking hard could lead to a skid. Examples include if there is snow, ice, water, wet leaves or gravel.
There is not too much you can do about this other than look for a safe opportunity to let them pass. Whatever you do, don’t try to let them know they are too close by hitting your brakes, as it might enrage them, and if they are not paying attention, they might run straight into the back of you. Although the rear vehicle is usually considered at fault in rear-end collisions, slamming on your brakes in front of them would be considered dangerous behavior and could reduce the chance you get the compensation you need.