Racist friend with problems

So I have this person in my life who’s not really my friend but has said a lot of racist and generally rude things. She explained to me that she has a tough home situation and that’s why she sometimes says stuff she doesn’t mean, but she hasn’t improved at all and I’ve called her out on stuff twice. I feel bad that nobody likes her and that she’s not getting much emotional support, but is it my responsibility to stay in this relationship? I haven’t liked her from the start but is it okay to walk away from a rude person that’s going through stuff? We’re not super close or anything and she’s a relatively new to me, only started talking around a year ago. Help!