The big weakness in old macs is the poor GPU. The oldest one I would go for is the 15 inch 2011 with the AMD chip. The iGPU is barely good enough in the 2012 series.
The 15 inchers come with a dGPU which will greatly increase their longevity.
For the desktop, you have a lot more capable GPUs.