Hi, you dont state wheather your Yucca is a house or garden plant, none the less when the flowers have died just cut the dead flower spike close to the main plant with secateurs or pruning saw.
If its a house plant with a thick bare stem thats got too tall, then you can cut this down to about a foot or more and it should resprout somewhere along the trunk. When the new shoot is growing well trim any long stub back to just above it.. Good Luck T bird+