I have done something similar before. I made and end gateway and used a repeating command block to TP the player when they were a block or two from said gateway. Use /execute in <overworld|the_nether|the_end> if entity @a[x=#,y=#,z=#,distance=..#] run tp <target> <location>.
@a[x=#,y=#,z=#,distance=..#] this should be the rough coords of the gateway and your distance can be however far from that point you want the command to trigger. The final <location> should obviously be the coords within that realm that you want to go. Doing it this way requires only one repeating command block. Hope this is helpful.