Depends on the year.
Later XT had stainless ball bearings and Borozon hardened races, later ones (M760 on IIRC) had an aluminium axle and smaller bearings. Seals were common and identical. In particular the latest ones (M780) had a drastically thinned freehub body that has a reputation for failure below 1000 miles (it splits and bursts!) There is a redesign which Shimano introduced.
STX is actually the tougher hub with more durable bearings compared to the later XT. Touring bike builders have learned to avoid any Shimano hub with an aluminium axle.