It takes a lot of courage to admit something like that, and it shows you are self-aware, which is actually a strength, not a weakness.
Everyone slips up and says things they regret sometimes. (I probably have much more experience than you. Lol.) What matters is that you are recognizing it and clearly care about how you affect others. That is the first step toward change.
Maybe next time, just take a deep breath before speaking and a pause, even if it is just for a second. (It can't hurt.)
You are not alone in this, and it doesnt make you unworthy of connection or friendship. The fact that you are reflecting on it already says a lot about the kind of person you are. Onward.