Since you only ask about metronome or recordings -
they both have their place, along with other options...
A metronome is useful, if not (very) boring. It can easily be changed tempo-wise, half, double, and everything in between. Also extremely useful to use in more advanced ways - set up and take each click as the & between the beats, for example. It will be relentless, and never vary whatever tempo you choose.
Recordings, if made with a click track, like most these days, will also be relentless, and will doubtless ingrain more than just tempo - number of bars for verse/chorus/etc.
Earlier recordings (50s, 60s, 70s) often vary in tempo - rather like a lot of live music does - not drastically, but the speeding up and slowing down reflect the mood of the piece at that moment, so not metronomic. It also means you have to play the approriate chords/riffs, so need to know the particular songs.
Playing with others is an option not mentioned, so I'll mention it! It's good and bad. You'll get more musical experience this way - good and bad! Playing with poor time keepers is an experience to be had. Trying to keep time either with them or against them will help you appreciate what timing is. Playing with excellent time keepers is also an experience, and certainly keep you on your toes.
For guitar there are many backing tracks available - 'music minus one' comes to mind, which one can play along to and they will inevitably be spot on time wise.