I think a strong possibility is the Agave Snout Weevil, which attacks Agave and related plants, including some Yuccas.
Here's a link to some info in it:
The evil weevil bores into the base of the plant and lays eggs.
The eggs hatch and the resulting grubs tunnel through and eat the plant from the inside.
Microbes are also introduced through the injury caused by the weevil which causes the plant to decay from the inside out. If your plant is at this stage it is toast.
Once the eggs are inside the plant it is too late, because insecticidal sprays can't reach the grubs.
Preventative sprays and soil drenches can be helpful with new plantings.
The scent of the blooms actually attracts the weevil to the plants, so I always cut off the flower sprouts before they can bloom. Obviously this has a down side if you enjoy the blooms. Personally, I like Yucca and agave for the foliage and structure first and foremost.
You could dig up the plant and check the roots and crown for grubs or evidence of grub damage. If you see them kill as many as you can and dispose of as much of the plant material and soil around the plant that you can.
If you plant new yucca or agave I would try to avoid planting close to the area of infestation if you can.