The 170 was the successor to the D17 Series IV. It has all the features of the D17 IV plus additional improvements. The 5020 is a newer, smaller tractor of approximately 20 hp, good for lighter-duty jobs such as mowing or garden work. The specifications for the 170 will be very similar to that of the D17 IV. Both used the G226 4 cyl. gas engine of 52 hp. The 175 was the successor to the 170 with hp increased to 60 hp. The 5020 is not in the same league and can't be directly compared to the D17 or 170. If you enjoy your D17 then you will find the 170 to be a nice tractor as well. It's a funny thing here in central Missouri - a nice D17 Series IV will bring almost as much as a 170. It's not uncommon to see a D17 IV with factory hydraulic-bucket loader bring $7000.
Good luck. All things being equal, you will be pleased with the 170.