How long have they been in that pot. Does the pot have a drain hole. The soil needs help! Look at this post: Soil for cacti and other succulents on this site. It is very helpful.
You might be able to cut the rotting one at the circled area. Let it dry/callous. then plant in new soil. I would say new soil for both. Would hate to see you lose such nice cactus.
Good Luck