Two good passages to consider are Hamlet I.ii.132-162, which begins
O, that this too too sullied flesh would melt,
Thaw and resolve itself into a dew,
Or that the Everlasting had not fix'd
His canon 'gainst self-slaughter!
and Macbeth I.vii, beginning
If it were done when ’tis done, then ’twere well
It were done quickly. If the assassination
Could trammel up the consequence...
Both men are concerned with the consequences of their actions. Hamlet is, in this soliloquy at least, very internal. His reaction to the terrible situation in which he finds himself (the monologue goes on to detail the ways in which his uncle and mother have been disloyal to his dead father) is to want to kill himself. Macbeth, on the other hand, is considering the consequences of murdering the innocent King Duncan to serve his own ambition.
Another difference between them is that Hamlet doesn't do the thing he's thinking about in this monologue. He doesn't kill himself. He doesn't consider violence against his 'wicked' and 'incestuous' moher (the ghost of his father also asked Hamlet not to, and instead to allow Heaven to decide her fate). Macbeth, on the other hand, who has no moral reason to punish Duncan, does do the horrible thing he is contemplating, even though he is worried about the consequences.
It's important to note that while both men are worried about the religious consequences of their action or inaction--in other words, worried about Hell--Macbeth dwells on it for much longer, and is also worried about consequences during his own lifetime: "We still have judgment here."
It's also kind of neat to see that the metaphor Macbeth uses to talk about consequences for crime is literallytrue in Hamlet:
Commends the ingredients of our poison’d chalice
To our own lips.
Claudius actually does die that way--Hamlet poisons him with the very cup he'd prepared to use to kill Hamlet himself.