As the characters proceed, the other end of the corridor or room never seems to get any closer. Try as they might, it always extends further away to the exact same degree that the characters proceed. This has a surreal, almost hallucinatory appearance, sometimes leading characters to believe it's an illusion (which it might be, at the GM's discretion; if so, Saving Throws apply).
Running doesn't help. Flying or climbing along the walls doesn't help. Teleporting or other magic spells might defeat the trap, then again, they might only put the characters "forward" to where they originally thought the edge of the effect ended, but which only places them a bit further on...except that, upon closer inspection, they actually haven't moved at all!
Teleporting out of the dungeon entirely, and then back in somewhere beyond the trap might work (or might not). Throwing a rope with a grappling hook to the end of the corridor or room will appear to go just fine (this is something often tried); the rope and hook make it to the target spot with the usual amount of difficultly or success, but when the characters pull themselves forward, they find the extending effect is still happening, even while holding on to the rope.
Defeating the trap might require Dispel Magic. If the GM decides it's purely hallucinatory, simply walking forward with eyes closed tightly might be able to defeat the trap. There might be a puzzle to figure out, a magical switch of some sort, a poem to recite, or other deactivation sequence. There may be a hidden side exit. If none of these things are available to the characters, they may have no option but to retreat, and go another way. A trap like this is often defensive, used to protect something.
Optional: There may be an item of some sort, secreted elsewhere in the dungeon, which acts as a "key" to this magical lock, allowing the characters to pass through normally.
Hallway of marble arches Alex Holyoake Unsplash License modified with Inkscape by David