I my experience, 5E is hard to balance the knife edge of challenge/TPK.
Fortunately, at least for me, my tables have been fairly happy with having a solely story driven game. So, I’ve not had to really worry about building either challenging or balanced combats. I’ve just erred on the side of caution.
However, if you’re running the game as it seems to want to be ran, it’s actually pretty hard to estimate how healthy the party will be at any given point in an adventure. The class-level tied abilities that are driven by rest periods make the game feel at some points like a supers game and then a game of resource management where the characters are “spent” and there super powers are not available and what could be a simple encounter ends up being nearly or actually a slaughter.
Compounding this is that encounters are implied to be “balanced” in some way based on average party member levels, but really this points to an arbitrary “balanced” party with full HP and a recent long rest.
In prior iterations of the game, encounters weren’t really expected to be fair or even beatable in the “kick in the doors and slay the goblins” manner which feels more like how the game is currently written. Slaying enemies in combat is the primary aspect of the game, far more that loot and/or story awards.