I'll 2nd Intellectual *******. A good Indy who knows the vehicle, has the tools, wants to make some spare cash, and can do it on a relaxed timeline will save you a ton.
The difficulty lies in finding this person. They exist, just hard to track down. Best bet is to talk to dealer mechs or shops willing to throw work to these guys or get references from the commercial parts pro at every auto parts store in your search area (no joke, the ones that know their clients can refer you to some badass indies or someone that knows them).
I will also 2nd the parts cost not being that bad. I bought my X with TC whine & bad clutch (but great prior maintenance!) from someone who couldn't afford to rectify either (hence a great price). I fixed everything in my driveway over the course of a couple of weeks. Used OE & OEM parts & replaced every pulley & piece of rubber (belt, seal, & water-oil-pcv-vacuum hose) on the engine with a full fluid change knowing exactly what came out (condition) & what went in.
My point for the OP is twofold:
1. The engine will be dismantled so if you pay an indy to do this negotiate & have him replace wear items as he reassembles it at no or minimal (negotiated, not hourly rate) additional labor cost. Water pump, thermostat, hoses, crank seal, any pulleys they find near letting go during disassembly, oil cooler seal, etc.
2. If the OP has spare time they can do it themself and save a very healthy amount of $$$.
This is not an incredibly difficult job, moreso time consuming. While mis-timing is a possibility, it is actually incredibly difficult to do (just don't start throwing covers on until all the timing marks align).
Probably not realistic given the OP was looking for a mech reference, but it is an option.
As to Just a Hunter, he normally gives sage advice but I have to respectfully disagree on this.
If the OP is looking for a mech they are likely not going to do this work themselves, and are also extremely unlikely to pull a motor and pop a new one in. So in addition to paying for the motor, they will also pay for any repairs it needs, full labor to put it in, & possibly to pull & transport it.
While this will likely end up costing significantly more than a simple T-Chain swap (and I mean a helluva lot if they go through a reputable resaler/junker who backs it with a warranty & pay others for every stage of the swap), that is not the most concerning thing.
If the yard or resaler didn't do a used oil analysis and/or compression test (and those few that do charge a premium when they come up good), you actually have very little idea what you are getting.
The used motor could have suffered oil starvation (continued running after vehicle rolled or was driven after major accessory systems were damaged in a wreck for example), overheated, had poor fluids and/or change intervals, etc.
A 177k mile engine that was running well & well maintained will likely keep running well after a (fairly) routine maintenance like this. This is like putting money into your 401k and knowing 100% you are getting a return on your investment.
Swapping the motor if there is nothing wrong with the old one is quite literally a gamble. Assume it costs $4-5000 total to get the pulled motor in. If you play Blackjack this is like hitting on 12 on a $4-5000 Blackjack hand. Potentially high rewards but no guarantee of winning in the end and a 31%'ish chance of busting.
I don't like those odds & though the actual percentage chance of getting a bad engine may be lower, the results of several family & friends junkyard-bargain-swaps have led me to discourage most from going down this path (several, as in way more than two, have had significant problems following swaps that resulted in significant money spent to fix the issues).
Not a fan of those odds at all.