HEX, RGB, and HSL all describe the exact same colours — convert between them and nothing about the pixel changes. What differs is which edit each one makes easy. Most frustration with colour comes from using a format that hides the thing you're trying to adjust, so the useful question isn't "which is best" but "which matches the change I'm about to make."
HEX: for copying and pasting a fixed value
A HEX code like #2f6f4e is compact, universally accepted in CSS and design tools, and unambiguous — which makes it the right default for storing and sharing an exact colour. It's a terrible format for adjusting one, though: there's no obvious way to make #2f6f4e "a bit lighter" by editing the digits, because lightness is smeared across all three channel pairs. Reach for HEX when the colour is decided and you just need to record or hand it off.
RGB: for reasoning about how a screen builds the colour
RGB spells out the red, green, and blue a display actually emits, so it's the format to use when you care about the channels themselves — mixing with code, nudging a single channel, or checking whether a colour is pure (one channel high, the others at zero). It's also where the a in rgba() lives, so transparency work tends to start here. What it's bad at is intuition: it's hard to look at three channel numbers and predict the colour you'll see.
HSL: for the edits humans actually ask for
HSL splits a colour into hue (which colour), saturation (how vivid), and lightness (how bright) — which happens to match how people describe changes out loud. "Same colour, less intense" is one slider in HSL and a guessing game in HEX. Building a palette of tints and shades is just holding hue and saturation steady while you walk lightness up and down. When you're designing rather than recording, HSL is usually the one that makes the next step obvious.
A workflow that uses each for its strength
In practice the three formats hand off to each other: explore and tune in HSL because the sliders map to real intentions, convert to RGB if you need to handle transparency or mix channels in code, then export the final value as HEX to store in your stylesheet or design file. Thinking of them as one colour wearing three outfits — rather than three competing standards — is what turns colour conversion from a chore into part of the edit.