Every chord in a scale falls into one of three groups: Tonic, Subdominant or Dominant. The group tells you what the chord does to you, not just which notes are in it. Once you start hearing chords as jobs instead of names, harmony stops being a list to memorise and starts making sense.
Tonic · Home
Degrees I, III and VI. This is rest. Your ear hears it as home base. Park here to open a phrase, to end one, or just to let things breathe for a bar.
Subdominant · Away
Degrees II and IV. One step off home, not really resolved but not tense yet either. It gets things moving. The IV is the classic way to step off the I.
Dominant · Tension
Degrees V and VII. This is the tension that wants to snap back to I. The tritone buried inside a V7 does the pulling, and nothing tugs your ear homeward harder.
Chords in the same group share most of their notes, and that's exactly why you can swap one for another. Your ear hangs onto the notes they have in common, so even when the bass moves underneath, the swap still feels surprising but right.
In C major: I (C–E–G) and vi (A–C–E) share C and E, two of the three notes. Swap a I for a vi and you keep the function but pick up a bittersweet minor colour.
IV (F–A–C) and ii (D–F–A) share F and A. The ii feels a touch more restless because none of its notes belong to the tonic chord, which is handy when you want a stronger push toward V.
Subs hit hardest when the melody stays put and only the chord underneath changes. You get a little jolt from the chord you weren't expecting, while the notes the melody shares with it keep everything from falling apart.
For variety: swap a repeated I for a vi. Same job, more feeling. For something richer: in I–IV–V, try iii–ii–V instead. More movement, same overall shape. For surprise: drop a vii° where the V would go. Lighter tension, a hazier landing. Borrowed chords: in a major key, steal iv, bVI or bVII from the parallel minor when you want a sudden patch of dark.