Look at ones that have peripheral pin select. That's one of the big features in the newer ranges - it allows you to allocate pins to internal peripherals rather than them being fixed and often conflicting in smaller pin count devices.
Have a look at the PIC18F14/15/16Q for 20 pin, 25/26/27Q for 28 pin DIP and 45/46/47Q for 40 pin
The only difference in the last digit is memory size.
If you are looking at things that need more memory, like graphics LCD control, also look at the DSPIC33EP512GP (or MC) 502 etc.
60 - 70 MHz instruction clock, 768K flash, 48K RAM etc.