Hamlet wants revenge for his father's murder. If he kills Claudius at the moment he's praying, Hamlet thinks, Claudius's soul will be pure and he'll be forgiven, and can therefore get into Heaven. King Hamlet died without a final confession/absolution/sacrament etc. and so his soul is wandering in Limbo. (I think that's the correct theological interpretation, but feel free to correct me if I have the doctrine wrong.)
Hamlet therefore wants to wait until Claudius is "dirty" again spiritually speaking so that his death will send him to Hell, or at least keep him out of Heaven.
Also, stabbing Claudius while he's praying is pretty cold-blooded. Making him drink the poison after Hamlet has watched Laertes die from the poison on the blade meant for Hamlet — and put there BY Claudius — is a rash act done much more in anger, and is vengeance for Laertes and the attempted murder of Hamlet as well (not to mention the death of Ophelia).
In short, Hamlet is way more pissed at the end of the play than he is in that moment when he comes across Claudius quietly praying. His opinion of the afterlife is not the only deciding factor staying his hand.