According to RichiWiki the D5 replaced the D6B. Both should have a D333 engine, although it appears one of the 6's built overseas had a D315 instead, and one of the powershift 5's had a D330. Depending on the year model they should all be approximately the same HP ( within about 10 to 15 HP depending on the actual age/serial number).
That said I know many older, direct drive machines had a brake that stops the driveline from spinning when the clutch pedal is depressed and the clutch releases. Wether yours has one or not I can't say for sure as I've only worked on the Power shift eqipped machines in the D5 and 6 series, but it's something you might want to check. On the machines I have worked on that had them, they were usually a royal PITA to get working because between worn lining, and worn linkage holes, they were all a real challange to adjust and make work properly.
As far as the 6 vs the 5, I just built a D333 in an older D6 last year. As far as rebuilding goes, your looking at somewhere around $2500 to $3000, per cylinder, to have one completely rebuilt. This includes labor taking it out and putting it back in, as well as building the engine, machine shop charges, aftermarket CAT parts, and in the case of the one I did, a new head at about $2500.
In other words if the engine on the 5 is freshly rebuilt and the gear grinding problem is something relatively simple to fix like a driveline brake, then I'd say the 5 is the way to go. If, on the other hand, you find something serious with the 5 causing the grinding then your more than likely looking at having the clutch pulled to solve the problem and, unless you do it yourself, your looking to pay the extra $2500, or more. So, one way oyur looking at a possible $2500, and the other a definate, extra $2500. Personally I'd rather pay the extra on getting a a machine with a know, good, rebuilt engine than on one with an totally unknown engine....the rest of the machine (ie the undercarriage, etc) all being equal or nearly so.
Hope this helps. Wayne