How do I teleport a player from a location and back while freezing and unfreezing the NPCs in the process with a press of a button?

I can’t figure out how to teleport the player to a location and back while freezing the NPCs in place, so that the player can press a button to teleport e.g. 10000 units on the y axis then press the button again with the NPCs exactly where the player left them.