What's the right word for a person who makes a comment towards another person habits, but they have their own habits?
hypocrite someone who says they have particular moral beliefs but behaves in way that shows these are not sincere. Cambridge Dictionary
The abstract noun is hypocrisy, the adjective is hypocritical.
A few examples:
- "we dislike hypocrites more than people who are straightforwardly awful" The Guardian
- "Sure, politicians are notorious for their hypocrisy." The Atlantic
- "The End of Hypocrisy: American Foreign Policy in the Age of Leaks" (Article title) Foreign Affairs
- "When Tom finds out that Daisy is having an affair of her own, his reaction is nothing but hypocritical." Essay about The Great Gatsby at Michigan State University.
Hypocrite is probably the word you're thinking of. In this context, it means a person who displays a false appearance of virtue.
For your example, a relevant idiom is "the pot calling the kettle black". It is used when one person is accusing or blaming another, when in truth both people are guilty.