If the brake fails you must slow down and use the parking brake.
Explanation:
Brakes nowadays have a lot of technology and the possibility of them failing is much less than before. But if this happens the first attitude is not to panic.
The first indication that the brakes are not working is for the pedal to go low. If the brake fails, it is ideal to reduce gears so that the engine brake helps to slow down and gradually pull the parking brake. It is not recommended to apply the parking brake abruptly. If you do this, the car may spin aggressively. Only apply the parking brake if the vehicle is in an urban perimeter and at low speed.