I thought excuse me was only suppose to used to excuse yourself or after you sneeze. Also, is excuse me a phrase or a idiom?
It is a semi-polite way of saying: "What you just said is offensive."
When someone speaks to us, and we do not hear what was said, it is polite to say something like, "Excuse me, but would you please repeat that." It implies that the listener was at fault for not paying close enough attention rather than that the speaker was at fault for not speaking clearly or audibly enough.
When saying "Excuse me" in response to something offensive, it is a way to suggest that the listener did not hear the offensive remark and cannot imagine that the speaker would have said what was just said.