Critical Role branches out from D&D with its homegrown RPG Candela Obscura: a spooky secret society simulator that wears its influences on its sleeve
It heavily depends on the tone of the campaign and the players' preferences. Some groups, in some games, enjoy death being a potential outcome, while others prefer for it to be completely out of the question.
There are also many degrees between both, like how much should potential death be telegraphed before making a decision, or whether it should be relegated to be purely an outcome of bad decisions and never caused by bad luck with dice.
My personal favourite is for players to make a decision when they are defeated: accept death (or retirement) and have their sacrifice improve the situation, or be left in the hands of fate and have to face other consequences (easily worse than a heroic death, if the players care about the story and the world).