How replaceable are CPUs?
I have a i7 8th gen desktop processor, can I just get a new one and swap it out?
You have to see if your motherboard supports the new one you are going to get
Depends what you mean by swapping it out.
If you mean in terms of installation, such as how easy is it to put in a CPU, easy.
If you mean in terms of wanting to upgrade your CPU, you have to make sure it is the correct motherboard for the socket. For example, a Ryzen 3 2200g is AM4+ but an Intel i5 6600k is LGA1151. So therefore, if you had a Ryzen, it would not work if you wanted to get an Intel CPU.
If you aren't sure what you can get, find out what motherboard you have.