Certified GKH Gardening Expert
So, the bottom portion of that is a Dragonfruit Cactus. The top portion is a type of cactus that does not produce chlorophyll and must have a host.
Unfortunately, they don't receive proper care while they are in store. Most get overwatered and will catch a disease then. This may not show up until later, even with proper care.
You can help quite a bit, though. Next time that you water, make sure to replace 1/4 of that with peroxide. This will help kill anything off in the soil, and increase the oxygen levels in the soil.
Other than this, there really isn't much to do about cacti that come down with infections. This will typically not result in the death of the plant, so with a little care, it will not hurt this any further.
This article will help you with the care of these: https://www.gardeningknowhow.com/ornamental/cacti-succulents/moon-cactus/care-of-moon-cactus.htm