You banish a creature that you can see within range into a labyrinthine demiplane. The target remains there for the duration or until it escapes the maze. The target can take a Study action to try to escape. When it does so, it makes a DC 20 Intelligence (Investigation) check. If it succeeds, it escapes, and the spell ends. When the spell ends, the target reappears in the space it left or, if that space is occupied, in the nearest unoccupied space.
RollQuest ships the D&D 2024 SRD as a content pack, on a 5e character sheet that does the maths - roll from the sheet and let the numbers work themselves out. Free to start.