I feel like I'm not understanding the difference between fermenting and canning

I've fermented a few things, but they tend to go moldy pretty quick unless I put them in the fridge right when they're finished. I thought the point of fermentation was to preserve food for longer, but nothing I've made would survive that long outside the fridge which seems to defeat the purpose. If I want to preserve fermented foods, do I need to do hot water canning on it? I've never done that, and the guides I've seen make it seem like it's a lot of work.