Certified GKH Gardening Expert
It may be rotting. Is it soft at the bottom? Cacti don't need much water, especially indoors. You can try cutting off the diseased part, letting the end callous, then repot in fresh, soil to root. Or, you can remove the cacti on top and graft it onto a new rootstalk.
https://www.gardeningknowhow.com/ornamental/cacti-succulents/scgen/cactus-going-soft.htm
https://www.gardeningknowhow.com/ornamental/cacti-succulents/scgen/grafting-cactus-plants.htm
If it is not soft and mushy, it may just be sunburned. Try giving your plant some shade during the most intense light of the day.