One look at the dictionary will tell you that the meanings of these two
words are deeply entwined; in many common cases (as in your examples),
however, they are essentially synonymous, and I find both of your
sentences quite natural, standing as they do out of context.
I suppose that
know usually carries the meaning of having already fixed information in one's mind (
Do you know all the capitals of the US states?), while
understand suggests comprehending the reality of the situation (
Do you understand that I really have a headache tonight and just want to go to sleep?)
Here are your examples fitted into what I consider an appropriate context:
A policeman pulled me over for speeding, but I was only going 30 kph, so I was really angry, do you know what I mean? (I.e.
from your previous knowledge of this kind of unfairness, can you see why I was angry?)
And I want you to stay in your room without TV until you finish your homework, do you understand me, young man? (I.e
. are you clear on precisely what I expect you to do now?)