Please post the EtreCheck data, as requested earlier.
One of the usual cause of these is apps that have been intentionally installed.
This isn't likely pop-ups.
Safari can and routinely show an impersonating message, usually form a certificate or DNS error.
(“This website may be impersonating “host name” to steal your personal or financial information”}
This also isn’t likely the sorts of hackers that you’re probably envisioning, either.
The certificate itself is valid in recent versions of iOS, and should work on macOS.
This might be an add-on app, an ad blocker, or maybe some malware that’s been installed.
The requested EtreCheck data will provide details on the hardware and software configuration, and can often help address this.
ps: If you’re concerned about scams and shlock and hackers? Back up. Upgrade. Better passwords. Two-factor. Etc.