I have the same issue as you do with nearly the same hardware ( 27in iMac, Late 2013 14,2 ). The beach balling and hanging got so bad I tried did a reinstall of the OS through recovery, which did not help. I did a clean install which stabilized it, but it did reboot one time. This seemed to have gotten progressively worse after each update.
I have an NVIDIA GeForce GTX 780M 4 GB and your vid card is also NVIDIA. I did some searching on the net and I think it is related to the lack of NVIDIA support for Mac OS after 2015.
I stopped using the Brave Browser, and that seem to have help. Not really sure why, but have a feeling that it has to do with hardware acceleration support, or the lack thereof. I only use Safari ( especially for video ) and although I get a ton of faults in console it has not crashed the machine. At least not yet anyways.
Hope this help, but am still looking for a solution, short of buying a new machine.