It can.
5e cant do high level dungeon style adventures.
It can, but it requires more prep and forethought. Wards against teleportation and scrying,
Guards and Wards, other reasons to not just leave the dungeon at will.
Recent-ish dungeons my high level party have done include:
-An old silver mine, now deliberately baited with small amounts of "stuff" (38gp; 3 +1 arrows) on the first level, and easy foes. Lower levels featured Intellect Devourers hiding, and anyone who got down to the bottom level would get a group of Mind Flayers + minions teleporting in behind them. The 18th level party Noped out and ran away when the 8 INT paladin was reduced to a drooling dead weight because he went over and looked in a crevice to see what was moving, then failed his INT save. Caveat: Nobody's been using divination stuff.
-A wizard's old vacation home. Lots of Guards and Wards caused fog, traps involving multiple Symbol spells, etc. We were a bit worried that someone might get killed when he got locked in a room with two Death symbols and an Insanity symbol while someone else was
Suggested to go fight an Illusory dragon, but they made it out.
-An abandoned (broken) elven research lab focusing on time travel. using wardstones (top floor) their souls and bodies were protected from aging as they descended...time ran faster at each level, so by the time they hit the bottom, they'd advanced about 1500 years in time, had some 'barely heard' Sending spells come in from people wondering why they'd been abandoned, etc... then they reached the level where the ogre death knight who had "just" conquered the place (10,000 years ago) was still dealing with the broken crystal and the blood was still running out of the dead wizards. They killed him and the invisible zombie beholders generating overlapping antimagic fields, and then went back up to the top, where their stones re-synced and they rejoined the main timeline.
They thought about leaving at one point, but their wardstones started buzzing and shrieking as they approached the entry without re-syncing them with the rune field.