the first thing I would try would be to Start up your Mac in safe mode. then test. then run the Mac in safe mode for 10 minutes, restart normally and test again. sometimes a safe boot followed by a normal boot can fix some issues.
also, the 2019 iMacs can run sequoia. so you might want to try upgrading to sequoia.
if neither of those steps work, I need to ask. are you using any apps that claim to "clean up" or "speed up" or otherwise "optimize" your Mac? and / or any antivirus apps? the only thing those apps are good for is causing major issues within macOS while providing ZERO protection or benefit. you would do well to uninstall them.
If you have no such apps, i’m thinking you should download and run the free version of EtreCheck so we can see if you have some software installed that is causing your issue. make sure you give "full disk access" to etrecheck. Learn how to use it by reading Using EtreCheck. if you need help interpreting the report, you can see how to post the report here by reading How to use the Add Text Feature When Posting Large Amounts of Text, i.e. an Etrecheck Report. and it automatically obscures sensitive things (like serial numbers) so you don't have to worry about sharing the report here.