One of these things are not like the ohter. The words are related. They are similar. They are not the same and they are not interchangeable.
A habit is no necessarily planed with a purpose. It may begin with an idea or just became something you began doing it kept doing it. There are some great habits. There are probably just as many that are not. (The same could said of rituals as well.)
Rituals don’t happen by accident. They are thought out, planned and faithfully carried out. Typically they are done exactly the same way at specific times and have some kind of emotional connection.
Habits are easier to change than rituals.
This information is helpful to understand between the two words. They are really different when you carefully think about them both. Smoking cigarettes is a habit, not a ritual lol. Some people may differ lol.