In D&D 5th edition, is there any kind of magical obstacle (trap, spell, monster, etc.) that a normal living creature couldn't get past, but an undead creature could? I'm specifically looking for something that a PC (of the right class/level) could create.
The 5th level Antilife Shell spell is exactly this - it creates a barrier that nothing alive can pass through.
The Symbol spell and the Glyph of Warding spell could be configured to allow undead to pass freely but trigger an effect on living creatures, but this would only work once.
The Antipathy/Sympathy spell could potentially be used to repel living creatures, but the examples of creature types given in the spell suggest that its target has to be slightly more specific than just "living", so this might not work.
After this, things get a little shaky, but most (all?) undead creatures are immune to poison damage, so a cloud of poison like the one created by Cloudkill could act as an effective barrier to living creatures while allowing undead to pass freely. Obviously some living creatures are also immune to poison damage, so this isn't exactly ideal.
The simplest obstacle would be a long underwater corridor, too long to hold one's breath. Most living creatures couldn't get through that, although of course a merfolk (or a druid wild shaped into a fish) could. Depending on your definition of "normal living creature", that might work fine.
Any sort of poison effect (even just a thicket of contact-poisonous plants) would also work.