Do not panic.
Yes, as hard as that sounds, panicking would not bring the car to a halt any faster.
Pump the brakes
Sometimes the pressing of the pedal repeatedly helps to gain some pressure which can help bring the car to a halt.
Downshift
If you are driving a manual car, the best way to slow it down is to downshift and let the engine braking bring the car to a slower speed.
Controlled weaving
If the road is relatively empty, slowly weave around without being very aggressive. The increased friction shall help bring the car to a halt
Pull the hand brake
If you have tried the above and not been successful, pulling the handbrake is the last alternative. It will cause the rear wheels to lock up and you will spin if you are at higher speeds. Pull the handbrake only if you are at lower speeds.
Shut the engine
This is worst case. If all other fail, just shut the engine. Yes you will damage the gearbox since the car is moving and the engine is shut but the car will eventually come to a grinding halt.