Before you ask for a roll from a PC, have stakes in mind. (In some game styles, you actually communicate the stakes to the player).
For a combat roll, the stakes are easy. If they swing a weapon and miss, and/or don't kill the monster, the monster gets to attack the party back.
When climbing a cliff, having making a downside to failure is perhaps too easy (the character falls).
The player when they make a roll has a goal in mind. If the player succeeds, they should achieve that goal with minimal complications.
If they fail, you need to have a complication in mind.
The complication should ideally move the plot in an interesting direction. "It takes more time, but nothing much happens" is not interesting. "Reroll until you succeed" is also not interesting, even if there is time pressure, unless that time pressure is very visceral (like orcs shooting arrows at you, and you unlocking the door as you shoot back with your hand crossbow).
So failure should either be a fail forward, or force a different move from the players.
A fail forward is where you succeed, but some complication happens: You unlock the door just as some guards come around the corner, you unlock the door but your lockpick breaks off in the door, you unlock the door but it swings open and makes a loud noise, you unlock the door but slip & cut your hand leaving a gash, splattering blood around the door handle, you unlock the door but it takes longer than you expect, and you hear the sound of a hostage being killed inside, you unlock the door but it takes longer and the enemy reinforcements arrive.
Forcing a different move is the "no, you cannot unlock this door" option. You can phrase this as "there is something jammed in there. You think you could unlock it from the inside..." which suggests the move of "thief enters some other way, and sneaks around to the door from other side". Or "the door lock is jammed hopelessly. The wall does look climbable, however." which again suggests a move.
The suggesting of a move is optional, and may not go over well, but it does prevent failure from seeming to be insurmountable. You, as the DM, need to have 2+ alternative moves thought up if you want to force an alternative move on failure.
You can fold the two of them. Failure on the lock forces a different move. The different move is either the players thinking something up, or making a streetwise check to figure out a different way in. That streetwise check on success suggests X, which is a relatively problem-free way in (climb the side wall & sneak in that window, which from the bricks on the outside are positioned lead to a staircase to the inside of this door), and failure suggests Y, which is a way that is actually unwise (climb the back wall & sneak in that window, which actually has guards sleeping in it) but still a way forward.
They don't have to follow either suggestion from that second check. But by arranging it that way you can prevent the game from locking up due to a skill failure.
So, in actual play:
Player: I roll to unlock the door. Blast, a bad roll: 9?
GM: Sorry, the lock seems jammed. You cannot open it from this side. Make a streetwise check, DC 15?
Player: (happy to roll more dice) I got a 7. Streetwise is cha? A failure, even if I add proficiency.
GM: You from the layout of the wall, there is a staircase leading down from the roof in the SW corner of the building.
Player: looks at you suspiciously.
So the player's move was "unlock the door". It failed. You forced a different move: a streetwise check to find an alternative way in. You even told the player the DC.
They rolled and failed. You still provided an alternative way in, with no comments on it.
They can either go with your alternative way in (which obviously will lead to some issues), or they can think up yet a different way.
Some of this design comes from Dungeon World and other indie games.
For more "fail forward", "let it ride", "force a move", "setting stakes" are all strings that you can search for on google for more details about this kind of skill check model, many of which inspired D&D design.