Right this is probably going to be quite a long rambling thing about OCD, apologies in advance, hopefully a point emerges at the end...
Some posters have mentioned diagnosis/labelling, and the issues with OCD being a bit of a spectrum, and maybe not being able to acknowledge it because theirs isn't at the 10 hours of hand washing full on debilitating level.
An alternative term that I've found helpful to get my head round it is 'ritual behaviour'. So what is a ritual?
(Cut Scene- Cov, 10,000BC).
Our mutual great x100 grandparents Coben and Babba, and their extended tribe, have found a lovely spot by a lake in the Forest of Arden. There are streams and fish are plentiful, so they decide to stop scratching around for nuts and deer across the forest, and settle here, by Babba's lake. With practice, they soon get so good at fishing that they only need to fish a couple of days a week. Grandad Coben starts to get bored, and he also misses his roast vension dinner on the Sun's Day. So he picks up his spear again, and heads off into the woods.
After trekking around for a bit, he spots some deer in a clearing on top of a hill (which he dubs 'Hill Top'). He makes a kill and takes it back to the village. A few days later he tries his luck again, but the deer are spooked and not there. After some trial and error, he finds that if he waits for two turns of the moon between hunting, there is always deer about there. Later, he starts taking his little grandson Willen with him, and puts markers on the trees and rocks to mark the path for him.
(fast forward 500 years).
Coben's Tribe are now living on The Folk's Hill, and have a lovely herd of cattle to sustain them, so don't need to hunt deer any more. However, it has been passed down the generations from Willen onwards that it is vital to follow the old path to Hilltop on certain times of the year. They put up a set of stones that align with the hill and sun to mark these times, and set up a post with a deer's skull on Hill Top. Eventually the skull keeps blowing off, but people have carved deer head graffiti on the post, and they elaborate the carvings to make a great totem pole.
So far, this ritual, that sprang out of a useful survival practice, has lost it's meaning and purpose- but is not harmful, and indeed has picked up new meaning as a way of connecting the tribe and marking the seasons. However, the tribe then come into conflict with a group of invaders. It is clear there is going to be a great battle, but this falls on the day of the procession to the deer pole. The tribe deliberates, but decides that it is too dangerous to risk the Wrath of Coben, so they head to worship as usual. The invaders are less picky, and massacre the tribe around their totem. The ritual has become harmful.
The invaders have no concept of what the totem means, but they have seen its power over the Cobentribe (whose name and customs they slowly adapt) and so allow it to stay, eventually beginning to visit it themselves to show their separate identity from their neighbours, such as the Horse Botherers to the East.
Finally, Christianity arrives, and The Church demolishes the Totem, smashes the sacred stones, and uses them to build a great church on Hill Top. The people still get to fulfil the ritual urge to visit the sacred place at certain times of the year, and even in the 21st Century people are still following in the footsteps of Coben, and continuing his ritual.
So, ritual behaviour is ingrained in us as a useful survival processing skill, but we are no longer hunter gatherers whose lives are timed to the seasons and the patterns of crops or game. Our brain can internalise and accelerate that process (especially when faced with the complexity and nonsense of the modern world), and so what was a quite sensible idea that helped us out of a particular situation, can quickly mushroom into a problem.
Knowing why it is happening can be helpful though, I find, and it is also good (at least for me) to lean into some behaviour, and accept it and make time for it.
So for example, most people do the quick 'keys, wallet, phone' pat down before leaving the house. Makes sense, takes no time, no problem. Mine is a bit more elaborate, but it's still checking useful stuff so I accept it and plan it into my day. What isn't helpful is getting half way to work, and then having to turn around in the pissing rain to triple check I locked the front door. This is a ritual I needed to stop, so I'm really strict with myself to check the door once when I leave, consciously say to myself 'It's locked', and then crack on. But, I understand how I have got to that point, what the underlying fear or problem was, and that makes it easier to manage and contain it.
If you read all that, I hope that made some vague sort of sense!