However, there are dangerous websites, that one has no way of knowing about unless there is software to recognize them.
Safari already does that: Legal - Safari & Privacy - Apple
Same about viruses and other software that can take control over one's system without the user having allowed them to do anything. I do not believe Apple protects against those.
Believe what you will, but you appear to have been misled — most likely, by those who want to sell you something you don't need. Follow the money. Works every time.
macOS already includes robust anti-virus and anti-malware features others already discussed. Nothing gets installed on a Mac without your consent. To install malicious software or even potentially malicious software on a Mac, you need to intentionally bypass multiple layers of defenses already incorporated in macOS.
It has been nearly a quarter century since macOS and its predecessor OS X was introduced. Yet there has never been a macOS "virus". Why?
https://www.apple.com/ae/business/resources/docs/macOS_Security_Overview.pdf
But wait, there's more! There will never be a macOS virus. Why?
After years of slowly moving in that direction, macOS adopted the iOS approach of completely separating the operating system from the user space in macOS "Catalina". It now exists on its own dedicated and secure "read only" signed system volume — isolated, cryptographically protected, and totally inaccessible to the user. If, through some (effectively impossible) means, an alteration to that volume is attempted such an attempt will fail. Not only is any nonconforming code rejected, any single solitary nonconforming byte is rejected:
https://help.apple.com/pdf/security/en_US/apple-platform-security-guide.pdf
Installing third party products from various companies that claim some superior insider knowledge greater than that of the most obsessively secretive company that builds Macs and maintains macOS is just... well, it may be rude to say it's a dumb idea, but there you have it.
Mac malware and inept developers are nothing new though. Protect yourself against malevolence and ineptitude by following these basic principles: Effective defenses against malware and other threats - Apple Community. That's all I have ever done on any of the Macs I own or control, even before Apple Silicon, before Catalina, before Intel. It's a practice that works. Non-Apple "anti-virus" products... simply don't.