Creating an encounter often plays out the same for me: I come up with ideas for making the experience epic, find myself unable to solve the "what if they fail" problem, and then minimize or eliminate the cool ideas, leaving me with a feeling of disappointment.
Example 1: The PCs are travelling along an underground path when they come upon a massive cavern that is mostly a bottomless pit. Upon a stony island in the middle of this abyssal sea sits an extinct subterranean civilization's capital. It is a walled city, with a single bridge leading in and out. The ancient bridge that crosses the chasm is rickety and might teeter or break as the players traverse–no wait, they would just die if the bridge broke or they fell off. Ok, the bridge is just normal.
Example 2: The PCs are raiding a magical weapons factory that uses materia-like components that are highly reactive. There is a big showdown with the security team. The players have to be careful not to cause a chain reaction that–no wait, that would kill them all if the whole place exploded. Ok, there is no risk of a chain reaction.
As a result, the players have no real reason to fear anything except the bad guys. I feel like saying "Oops, you fell and you're dead and that's that" would be really unsatisfying for the players, but running around a world covered in bumper pads is unsatisfying too. How do I make a fantasy world deadly, but not so deadly that the players choose to stay home and work the family farm?
Group Checks, Success with a Cost, and Skill Challenges
These three concepts are meant to be used in tandem, but can be cherry picked to suit your style of play. I have the most experience using them together.
This is pretty simple. Half the group has to pass at doing some thing. In the examples you provided, this represents the party collectively crossing the rickety bridge, or a group effort to handle Materia.
Perhaps the Bare Minimum of 2 out of 4 people make the check/save.
"Wizardface nearly falls through a gap in the rickety bridge, but McFighterson manages to grab his wrist in time. The rest of the walk is slower as you take your time, but there are no other events of note."
You can secretly game this by knowing how likely it is for at least half the party to pass, based on the dc and their bonuses, and you don't have to worry about the wizard with the -1 acrobatics (or whatever).
If your group is bad at remembering inspiration, this is a good time, in my opinion, to remind them it exists.
Success with a Cost
"SwaC" is a hugely useful tool (okay, no one calls it that... yet). Maybe you want to leverage inspiration, mundane gear, spell slots, or hp.
This can be preemptively used, without rolling. I've had situations where I allow things to happen, wherein the party pays up front (usually at the party's suggestion).
This allows them to enjoy the narrative feel where there is still a cost.
Disclaimer: I have adopted this from Matt Colville and his video on Skill Challenges.
This does not work for every scenario, but can be made to work for many. Choose a threshold, based on difficulty of the thing. Maybe it's 3 successes and 3 failures (adjust the number of successes for more difficult things). It may help you to think of this as a "race against time". In the case of the Materia example:
Then the group goes around, requesting to make proficient skill checks. The same skill cannot be used more than once, by the same character. Characters must be proficient in the skills. Players should be able to justify the skill in question. "No, unless you can explain how animal handling would help, you can't use it."
This might go something like the following:
Honorable Mention: Make failure less fatal
Is there something about your cool scenario that could save the failing character? Perhaps the ravine is sloped and leads off into some unseen area? Perhaps the highly reactive Materia irradiates (bestows a curse) onto the nearby characters? Maybe the collapsing building only does 6d6 damage instead of instant death?
This isn't always going to fit the tone you want, but often, you can find that the unknown is just as terrifying as the certainty of death.