temperature is fine at idle, but gets hot when driving
Slow coolant flow, causes could be a bad water pump, partially plugged radiator, thermostat not opening fully, electric cooling fan running backwards, sounds weird I know but I have seen it happen.
Most probably catastrophic head gasket failure that's allowing percolation of exhaust into now-superheated coolant. Send this chariot to a bone yard....
Like TheSub said (except getting rid of it - that's up to you). Good read: https://allwheeldriveauto.com/subaru-head-gaskets- problems-explained-part-ii/
Looking for a Used Legacy in your area?
CarGurus has 15,852 nationwide Legacy listings starting at $999.
Search Subaru Legacy Questions
Subaru Legacy Experts
Related Models For Sale
Used Cars For Sale