The word "duh" is used as an exclamation when you want to imply that something that was said or done is obviously stupid or silly. It's not rude to use "duh". It's just a harmless word (most of the time).
"You walked home in the rain without an umbrella, did you get wet?"
"Ya I did...duh"
"Darn, I locked my keys inside.... duh .... I'm such an idiot"
"If that beautiful person wanted you to kiss them, would you do it?"
"duh, of course I would"