:salamext:
My late grandma (may Allaah forgive her sins and grant her Jannatul Firdaus, Ameen) always had a habit of saying Bismillaah before doing anything. Seeing that in my childhood, now if anything happens, e.g. a car pulls out in front of me all of a sudden and I have to brake, etc. I mostly say Bismillaah, even if I say it with as much force as you are using a bad word.
Try and make this your habit :ia:, and Allaah will help you overcome the bad habit, Ameen