I would explain politely that I thought the remark wasn't kind, or it was insulting, or maybe rude. If confrontation continues or there is really bad language then I would just walk away. Can't be doing with people who hurl insults.
If it's a friend, though, then I'd try to work it out. However, my friends tend not to be that sort of person. Some people have an anger problem and just need to be treated with calmness.