In the US, at least, when someone says something is “on my mind” they mean they have been thinking about it a lot and probably want to say something about it. It isn't necessarily a bad thing, though.
If it is something serious that they have been worrying about, they might say it is “weighing on my mind” as though their mind was carrying a burden. (“Weighing on me” is a bit more common, though.)
And after they have talked about it, they might say “That's a load off my mind!” meaning that they are less worried now.
On the other hand, “in my mind” is a much more general and abstract phrase. It's not really an expression at all, but a literal statement that something (such as a thought or a fantasy) is a mental construct, as opposed to existing in the real world.
In many parts of the US, it is much more common for people to say “in my head” rather than “in my mind,” though they still mean it is in their mind, not physically inside their head.“In my mind” is used when the speaker thinks of you,but not in a way that makes that person really worried,or anxious. For instance you've been expecting something really nice from your aunt and she tells you, “Don't worry, I always have you in mind.”What does that imply? This means she will definitely get it for you, but not that she's worried,or constantly bothered. I'd say this kind of ‘thought’ is also sometimes erratic.
“On my mind “ usually refers to something that really bothers you, or something that constantly comes to mind,or you constantly remember.
Good content