ひたる is almost always chosen when the target marked with に is a non-liquid or abstract environment like 思い出, 喜び, 感傷, or 闇.
When the target is a physical liquid, you can use both つかる and ひたる, and they are more or less interchangeable, but there is a subtle difference:
- ひたる refers only to the physical state of being completely submerged below the surface.
- つかる often carries the nuance that something (like heat or components) from the liquid seeps into the object and has a certain effect, in addition to simply becoming wet. People prefer to say 温泉に浸かる because onsen has some healing effect.
The same goes for their transitive counterparts, つける and ひたす. In cooking, ひたす is used when simply immersing something completely in water, while つける is often used when you want to infuse flavor or achieve similar effects. This is why Japanese pickles are called つけもの (although the kanji 漬 is preferred when referring to pickles).