If you have OCD, then this might be the intrusive thoughts of OCD, as there is a genetic component to it. However, diagnosing kids this young is difficult, and it's not at all uncommon that kids with a psychiatric diagnosis at one point are found a few years later to have been misdiagnosed. So... time will tell. As someone with OCD, you are in the perfect position to understand what these intrusive thoughts are like.
However, it might be that she's a really sensitive little girl who is merely contemplating such possibilities, thinking she'd like to say a bad word, smack her sister, see her friend squashed by a truck, or is thinking disgusting thoughts, and just doesn't know what to do with these thoughts on taboo subjects. This is about the time when her lexicon of the more adult taboo words is beginning to grow.
It sounds like she might feel guilty about having these thoughts and needs reassurance of her goodness/acceptability. It's great that she's expressing these thoughts instead of trying to cope with them by herself. I would think your first responsibility is to reassure her that strange and even irrational thoughts are normal and do not indicate what her behavior might be or that she is not a good person.
Try to have these conversations in an accepting and matter-of-fact manner, without drama or too much special attention, so that she will not use telling you these things for attention, but do empathize have them. Kids are deeply feeling little beings who feel the complete range of human emotions but don't always know what to do with them. They need to know they are loved for who they are, not just what they do. Help her to differentiate fact from fantasy. Help her to understand that some thoughts are like hiccups: everyone has them, you can't stop yourself from having them, and they can be anything from mildly annoying to painful. But they go away, and don't cause lasting damage. A rich emotional vocabulary might also help your daughter.
If you're familiar with the children's writings of Roald Dahl, you might read some of his books to her aloud and discuss the more outrageous ideas with her.
Observe, listen, discuss. And if it looks like OCD, please do talk with her primary care provider and be her advocate.
E.g. Immediately in the opening of James and the Giant Peach, James' parents go shopping in London and get eaten by an angry rhino who had escaped from the zoo, leaving him orphaned and adopted by the Worst Two Aunts on Earth. After reading for a while, you can ask questions that lead her to a conclusion that thoughts are just thoughts. "Do you think it's likely that someone's parents would both be eaten by an escaped rhinoceros? What do rhinoceroses eat? Why did Roald Dahl tell the story that way? Does even having such an idea make Roald Dahl a bad person?"
In our home, I read to our children every day, from Greek, Egyptian and Norse mythology to Winnie the Pooh, Robert Frost to Shel Silverstein. The first two poems my eldest memorized (at the age of six) were Frost's Stopping by Woods on a Snowy Evening and True Story by Shel Silverstein. Maurice Sendak, author of Where the Wild Tings Are, said, "In plain terms, a child is a complicated creature who can drive you crazy. There's a cruelty to childhood, there's an anger. And I did not want to reduce Max to the trite image of the good little boy that you find in too many books."
A Child's Garden of Curses: A Gender, Historical, and Age-Related Evaluation of the Taboo Lexicon, Kristin L. Jay and Timothy B. Jay, The American Journal of Psychology Vol. 126, No. 4 (Winter 2013), pp. 459-475