When the party is out of resources (and 99% of the time, "resources" means hit points and healing magic), they have to stop and rest. There's nothing else they can do. If the DM doesn't let them, all he does is guarantee that they'll suffer a TPK in their next fight, unless he fudges rolls or pulls a deus ex machina to save them.
I'm not sure what other options you think the players have.
#1) "Run Away!!!" or otherwise avoid a particular confrontation. Using your mind for sneaking & trickery is as important as anything else the PCs have at their disposal.
#2) TPKs are never guaranteed- they may get captured or perhaps the dice will go their way. The foes may not be intent on killing. Also, see #1, above.
#3) Plan ahead a little better...which may involve things like running away from an encounter earlier in the day, or letting the fighter finish off a foe instead of casting that additional Magic Missile.
Its not neccessarily about hosing the party.
Like I said, sometimes the question of whether a party can rest or not is sometimes out of the DM's hand. If the party chooses to camp in the location haunted by a Spectre who is due to rise in 1 turn, that's their problem.
Just like real life, sometimes the game doesn't let you take time to recharge. Sometimes you, or in this case, your PCs, have to reach down deep and find something within themselves that they didn't know they had.
For example, in the movie
The Survivors, Robin Williams' character "Donald" gets in a gunfight in the woods with an assassin. He shouts out to his opponent:
Donald: Jaaaack?
Jack: Yeah?
Donald: Time out, OK?
Jack: Time out?
Donald: Time out.
Jack: What do you mean, 'time out?'
Donald: You're not gonna believe this. I was in a hurry when I left the cabin this morning, and, well, silly me, I got the wrong bullets.
Jack lies and grants the "time out" and as soon as Donald emerges from cover, begins shooting at him.
In game terms, Donald has no resources, and is facing an armed and more experienced opponent intent on killing him. (Spoiler: its a comedy starring Robin Williams- Donald survives the gunfight.)
Similarly, you can find the same dilemma in classic "survivor" movies like
Surviving the Game,
The Naked Prey, etc., and in classic modules like the Slaver series of 1Ed.
IOW, "out of resources" ≠ Time Out for the party.