Thais who know me (juristic persons, doctors etc.) put khun in front of my surname. Thai friends use it in front of my first name sometimes, usually when they are talking about me to guests or kids. Kids obviously say 'khun firstname'. As do the 'outsiders'.
Laundry ladies, tuktuk drivers etc. who aren't party to my names usually ask 'you want xyz mister?'. Or if they want to attract my attention like when I'm heading the wrong way or left something lying on a counter, whatever, just 'hey mister'.
I felt really offended to begin with and reacted quite unpleasantly at times 'cos it obviously grates. It's highly impolite in the west. But I eventually figured it's their way of saying 'sir', a word they aren't familiar with. Noone's ever said it with malice as far as I can tell. Usually it's someone trying to be helpful or offering me something. Markets are another place.
Can we seriously expect Thais to master the vagaries of 'Excuse me sir ...' as opposed to 'Hey mister'? Then just imagine 'Khun, you want tuktuk?'. Pretty weird.
A nurse saying 'mister surname' on the other hand is probably trying to be polite or even try their English, not racist.
A wise man once told me 'the world is your mirror. What do you see in it?'