On the buses, your destination is often the last stop so this is rarely a problem. If it´s not the last stop, then the conductor or another passenger will invariably tell you.
On the trains, if you´re going to a popular tourist destination (Chiang Mai, Surat Thani) then it´s easy. An train official will always come round and tell you, every other tourist will get off and touts will be running alongside the train holding signs promoting their accommodation outside the windows before the train has even stopped ! If you´re going somewhere less touristy then you might want to ask someone and/or make sure the ticket collector knows where you are going.
If you need them, the Thai phrases are pretty easy:
tee nee tee nai (krap/ka) ? Where is this ?
tee nee...mai (krap/ka) ? Is this... ?
A more tricky one is:
chuay bork meu-rai rao mah teung... Please tell me when me get to....