Is this an aloe plant or a cactus? What should I do with it since it is leaning so far and getting unsteady? Thanks for advice!
Yup it's an aloe variegata. I love this kind of aloe and would love to get one myself. It seems to be etiolated a bit. Do you grow it indoor? If you grow it beside a window it's recommended to turn it every other day so it's receiving sun evenly. If it is not very steady in that pot you might want to consider transplanting it into a slightly bigger pot and put some pebbles at the bottom of the pot, also some top dressing, to make the whole pot heavier.
It looks like it was growing toward light/sun for a while, then turned opposite direction.
I think you should use some large rocks to support it.
I had few smaller ones, when I replanted it, keeping it more steady (doesn't need them any more, just left them there).