Difference in doing CBT for anxiety for ocd?

I know in ocd you need to do exposure therapy where the only way to heal is the quit the compulsions aka the behaviours and challenging thoughts will not help if only make it worse. However in CBT for anxiety you can challenge thoughts how does that work because I'm struggling with anxiety as well as ocd it's conflicting