The two words has similar meaning, and can be used. But in some cases one word is favoured more than the other. It's almost the same as:
"Do you COMPREHEND this?" (你懂吗?)compared to "Do you UNDERSTAND this?" (你明白吗?)
PoLo's example, 你明白他吗 is more correct, as it is: "Do you understand him?" which sounds better to 你懂他吗? "Do you comprehend him?"