Do you think I should apologize for being racist?
Yes you should, did you say something that was racist?
My friend was angry and said that I used racist words towards him.
You should apologize right away and in the future choose your words more carefully. I'm sure you just made a mistake but you have to understand how hurtful racist words can be to others.
It's hard because sometimes I say things without thinking.
You really have to put more effort into what you say because racist words are very hurtful. Spend some time reflecting on why those words are even part of your vocabulary in the first place. Think and choose your words more carefully.