This particular iMac can easily handle the tasks you've listed above save for heavy photo editing with Lightroom and Affinity. Don't get me wrong: of course you will be able to edit photos but it'll be pretty slow compared to a modern Mac with a 4-6x faster CPU and an n-times faster GPU where n is easily double-digit if not triple-digit in certain very specific exotic cases. You won't really notice a difference in regular office tasks such as MS Office, Excel, Remote Desktop, email, etc. between a brand-new iMac and your iMac once it's been upgraded with more RAM and an SSD.
The good news is that your Late 2009 iMac will still run 10.13 High Sierra, which means you're looking at approximately another 2.5 years of software and security updates from Apple (support for 10.13 ends around October 2020). Alas, you should easily be able to squeeze out another 2-3 years if you upgrade your RAM to 8-16GB and add a 256-512GB SSD, depending on your disk space requirements. I'm a bit undecided on the actual amount of RAM you need - office tasks will be completely fine with 8GB and won't benefit from 16GB at all so it really depends on how much photo editing you do and how big those files are. Nevertheless I dare to say that 8GB should be more than enough for 99% of all users for the next 2-3 years.