I think being mindful is practical. You recognize that it is unhealthy and harmful to have these thoughts, and that's great. Many people can't see that their internal dialogue is unproductive, so identification is a great initial step. Recognize that it will take time to really transform this, especially if you have been repeating these things to yourself for a while. When it occurs and you are able to catch it, try to replace it with something else. Don't give yourself a hard time about it- these feelings are defence mechanisms that are partially out of our control, though we can shift the narrative. Why are you saying these things? Identify the feeling that triggered it, analyze it, accept it, forgive yourself, and move on. Repeat as needed. Something that may be useful when you find yourself wishing others ill is to instead send the opposite energy. People hurting others is not okay, but clearly people who are toxic and hurtful are people to be pitied, because what has made them this way? Wish them well, hope that they can grow as people, and this then feeds that more positive energy back to you and conditions you to respond to anger and hurt with kindness. This is more for your own sake than for anybody else's, because as you said, at the end of the day the person you're actually hurting is yourself.