In general, say the rocket like the Soyuz blows up any time during flight (not on the ground). Is there some way to ensure that the crew capsule can be returned safely back. If it is high enough but yet suborbital, one could probably hope for using the regular landing mechanism. But what the time before that?
Crewed spacecraft usually come with a launch escape system — a solid rocket engine designed to separate the spacecraft from the launcher in an emergency.
This includes high altitude and low altitude failures, even an explosion on the launch pad; the LES will lift the capsule to an altitude where either the normal parachute descent system or a dedicated emergency parachute will work safely.
In fact, the only actual use of a LES on a crewed mission, Soyuz-T-10-1, occurred when a rocket caught fire on the pad. The capsule was separated only seconds before the booster exploded.