Use a compression ball valve (the kind with a lever that travels 90 degrees) for the replacement. They tend to give longer service than stop & waste or gate valves.
If the new valve occupies more space than the old one, easier chore. Ball valve bodies are generally longer than a S&W or gate valve, so that's often a gimme.
Calculate the insertion depth on each end of the new valve, then "cut out" the correct area of the existing pipe valve.
Assuming it's copper pipe, debur the cut ends, polish the insertion depth +, with crocus cloth or emery paper, wipe it clean and install the new valve and parts. Slide the nuts/ferrules over the pipe ends first. Nut first, then ferrule.
Hold the valve body with one wrench, while tightening the ferrule nut with another wrench. Make the nuts pretty snug, but do not crush them to death.
If the connections drip a bit once pressurized, snug 'em a bit more until the drip stops.
Had a customer many years ago, that wanted another "isolation" valve installed near his hot water boiler. Chronic worry wart about everything.
He wanted to shut the water off to the rest of the house when they went away, but wanted the fill valve on the boiler to have water.
Pain to drain things down to sweat another valve in, so I used a compression ball valve, which upset him when they got back from vacation and he saw the new valve. His wife said he checked it several times a week for months, to make sure it hadn't started dripping yet.
Had lots of fun with him about that, over the next 10 or 12 years. And it never leaked a drop.