The sanctimonious person sounds like a hypocrite when he preaches to a friend about the evils of drugs, while he drinks one beer after another.
Sanctimonious is a twist on the words sanctity and sacred, which mean holy or religious. A sanctimonious person might think he's holy, but their attitude comes across more like "holier-than-thou." Though sanctimonious people might try to act like saints, their actions are far from pure or holy, which just makes them sound like hypocrites.