Hi, who knows how to do that if someone stands afk for about 1 minute that the player will be teleported?
This will probably only be possible with a plugin, so if you can program that shouldn't be the problem.
Otherwise look for AFK plugins on the internet.
I guess with a plugin or maybe something with data packs or command blocks, but I'm only sure about the plugin.
With commands:
You could just spawn an invisible armor stand in every player every minute, and then in the next minute teleport all players whose distance to such an armor stand is 0. And then delete all the ArmorStands and spawn new ones in each player.
Or you look for a plugin. ^^