As a general rule
@Eliška *************
no you can get out and right back
BUT
with that being said, some countries and some borders have rules that you have to spend a night IN that country before you can come back.
So choose your border bounce location carefully and post on a group related to where you stay in thailand to ask for recommendations