Unfortunately the best performance comes with the larger 27” iMacs. The 2017 models offer good savings, specially on the Apple Refurbished Store. If your budget limits you to the 21” iMac, consider the 6 core i7 processor over the i3 and i5 alternatives. The 6 core will handle filters and multi layers much better.
You’ll ultimately want 32GB of RAM, but you can get just 8GB and buy additional RAM from vendors such as OWC and Crucial much cheaper. The RAM is not easily installed by end users that do not have a comfort level withi disassembling major parts of the computer. If your budget permits, get it factory installed.
I don’t believe you have a choice of graphics/video cards in the 21” model and that ultimately will contribute to lack of speed with some filters and tools in Photoshop.
Internal storage will require the fastest SSD you can afford. The Fusion Drive, while larger, will really slow down with multi-layer files and large TIFF’s. I would look at fast external SSD Thunderbolt 3 drives for storage and scratch disk for Photoshop. A fast 7200RPM spinning drive will be good for long term storage and archiving projects you’re not currently working on. The spinning drive could be USB3,.
The larger 27” iMacs offer better graphics cards, and faster i7 and i9 processors.