America will prosecute Americans for doing certain things that are illegal inside America outside its borders. As another example, if you take a boat to international waters and kill someone on it, you're going to get arrested and prosecuted when you get home.
America will not arrest or prosecute someone from the UK visiting Thailand as a sex tourist.