You need to look at power capacity, and connectors.
If your old power supply is good for less power than your current components need, forget it. There should be a label on it informing you of the capacity. However, this figure is not to be taken as absolute, especially with older power supplies. I don't strictly follow the rule of thumb I was given when I get a new power supply - which is twice the wattage your system needs - but with an old one, definitely take that to heart, give it more headroom if you can.
Most modern power supplies and motherboards will have adapters that only plug in the right way. This good, but not good enough if you have a graphics card that at any point in its life was considered to be high-powered. If you have such a graphics card, you need to be mindful that it's getting enough power from all the relevant connectors.
You of course, want to make sure that everything you unplug gets plugged back in with the right connections to the new power supply. Don't try to jam anything.
Some prebuilt computers come with proprietary power connectors for their cases, motherboards, and power supplies. Thus, if you mix and match proprietary of these components with standard, you might not get to plug everything in. If any of these are proprietary, there's a good chance you'll need a matching replacement rather than anything you can get off the shelf. If it's old enough, it won't likely be a cheap replacement. Computer parts do get cheaper after some years, but when enough years go by, they get expensive again.
Be aware that swapping out a power supply is almost as much work as building the computer. If that intimidates you, get someone who knows what they are doing to help.