Dharma is the way of life. To be one with your dharma is to trust and understand (not know) that your life is always just so. Complete and utter perfection. Everything you do is meant for you to do, because it is happening. If it was not meant to be so, it would not happen. It is impossible otherwise.
Karma is your thinking mind. It is the fruit of your action. Karma happens when you question doubt or deviate from
Dharma. The Buddha stressed there is no bad karma. That is because there is no scorekeeper punishing you except you. Karma comes when you question life as it is just so.
Say you want a coke but you doubt and question and ultimately get a sprite. Well, had you gotten the coke, x would Have happened. You created karma in your thinking and getting sprite. X will still happen, but there is now t, u, and v in the way of coke and x which will still Happen. And there is nothing bad about the sprite, nor the thought, just karma.
So the only punishment comes from you wishing for that coke and questioning your sprite decision.