This is a big question. There’s a different answer for every customizer, and for every figure. As the mechanics of almost every figure is different from another, there is no single method. For my part, I’ve never tried to swap a ball-and-socket joint, only “cut” or “swivel” joints.
Lately I’ve switched to using magnets for swivel joints. They’re relatively easy to use, and frankly, they’re fun! I’ll drill shallow holes in either side of a joint and fill with rare-earth magnets. So much easier than making new pegs!