Please download and run EtreCheck and share the resulting report to the clipboard. Then open a new reply here, and press the Additional Text button (that looks like a printed page) to get a text input box big enough to paste the hardware and software configuration report here, and paste and post that report here.
An add-on first-few-hops VPN client package is a good potential culprit as was mentioned above. Other options for culprits can include add-on anti-malware packages, and add-on security apps. Hardware problems are also a possibility.
Firefox has its own certificate chain and its own certificate store and AFAIK its own SSL/TLS/HTTPS implementation and does not depend on (most of) macOS for that, which means this probably isn’t involving the local certificate store.
And DNS is typically not slow for just HTTPS.
Is the iMac connected to the internet via Wi-Fi, or wired Ethernet, or both?
If this is happening your own network, also check the Wi-Fi router firmware and update that to the most current, and restart that device. That’s probably not the issue here, but I’ve also seen (buggy, confused) Wi-Fi routers get recalcitrant with specific Wi-Fi clients.