I'm afraid that both those stems look too mature to use as cuttings, but if it ever grows some little sideshoots from the base you can use them as cuttings.. I think it's grown long and lanky because it needs much more direct light rather than the filtered light it is getting - yucca's need as much sunlight as they can get and prefer to be outside in the summer - although if you take it outside this weather do it for a little while at a time to start with as the leaves will not be used to the sunlight and may scorch.
I think I'd try taking it out of the pot, turning the rootball on its side a bit so the stems are more vertical and potting it up like that - and when you put it in the pot put a sturdy cane in there to tie the stems to as they don't look strong enough to support the the weight of the foliage.
I would use John Innes No 2 compost, with the addition of about a quarter as much horticultural grit. Tease the roots out a bit to get rid of some of the old compost, and pot it up firmly - you might need a bigger pot too.
As I said, lots of bright light, and not much water.