There’s some great answers here. I think it depends a lot on what your aims are, and what sort of person you are, in terms of are you into computers and technology, or whether you would rather avoid it.
One option for practice purposes is to just use simple backing tracks from YouTube, Spotify, or Bandcamp played through a speaker system (if you have a Bluetooth speaker, for instance).
For instance, I used to play backing tracks through my Sonos system to play along to.
You can get full song backing tracks, or simple chord progression tracks. For percussion backing, there’s applications like Loopz which have a library of drum tracks in different styles, or there’s options like Lumbeat on Youtube.
You can also get applications like iRealPro which you can use to create simple backing tracks.
Personally, I’m a geek, and I was interested in DAWs (Digital Audio Workstations) and audio recording technology long before I started learning the guitar. The capabilities you get from a relatively cheap audio interface and a modern DAW are, in many ways, superior to what was available to even professional recording studios 30 years ago.
It does, however, come with a lot complexity and a steep learning curve, not just to learn how to use the software, but all of the techniques around recording, including things like gain staging, EQ and compression, mixing, etc.
It’s also a bit of a rabbit-hole with regards equipment. As @adi_mrok has suggested, you can plug something like a Katana amp (many other options exist) directly into a PC to record and get great results.
But you can also get a microphone and an audio interface (AI) and record that way; that is more traditional but also a heck of a lot more hassle and difficult to get good results.
But, on the other hand, having an AI also gives you the option of recording vocals and other instruments: you can plug your keyboard into it, for example.
Loopers are a step beyond simple backing tracks, where you can do a limited amount of recording and overdubbing without the complexity of a full DAW setup.
Note that most looper pedals will let you connect any instrument and record that into the loop. So you could, for instance, plug in your keyboard and use that to record a loop, then disconnect that and plug in your guitar (or use an AB switch to switch between them) and overdub/play along with that.
Some loopers have simple built in drum machines, which may be useful for you.
The Trio+ is a great tool, and a step above most other loopers in that it also includes an auto-accompaniment, so you can build your own backing tracks which include drum and bass.
Note that many of the people who do looping performances on Youtube have quite sophisticated setups which are designed for live looping performances. These take considerably time and skill to put together, and will be quite difficult to replicate. For example, here’s Rachel K Collier describing her setup and process:
Also, a lot of artists who use looping for their performances will write songs which work with their looper pedals. Most simple looper pedals are not really suitable for traditional song structures as you can only use one loop (one song part) at a time.
The Trio+ does allow you to build multi-part songs but, IMO, it’s something you would have to prepare in advance. You can also do this with loopers which have multiple memory slots, like the Boss RC-3.
Note that some loopers which do have multiple memory slots can also be plugged into a computer and have backing tracks transferred to them. So, for a looper like the RC-3, you could have dozens of backing tracks loaded into it for practice purposes.
Note that none of these options are exclusive and most people end up with a bit of everything, depending on what suits them at the time. Personally I would start with backing tracks and then move to a looper if you want to do some simple recording/layering. When you feel ready, you can move to a full AI/DAW setup.