Ransomware is out there, though the only two or three known variants ever found have been patched against. In reality, ransomware is simply another Trojan since you have to download, install and run it. It can't get on your Mac by itself.
The latest version of MalwareBytes for Mac has a function to try and halt ransomware. Like standard AV software, the full version runs in the background all the time. Except, it's not watching for viruses (except maybe to let you know a Windows virus came in with an email). It's mostly watching for an app that is suddenly trying to encrypt your files. MalwareBytes will then do its best to shut the app down. But as mentioned, what known ransomware there is has already been patched against at the OS level.
Worm - smarter than a virus. They can search out other computers across a network all on their own and attempt to infect the ones it finds. The only known (and now long dead) worm was Oompa-Loompa. Also known as Leap-A. It first had to be installed by a user as a Trojan. It then looked for other users to infect across a network who were in your Messages account. With Unix in the way, it couldn’t install itself on the remote computer and would cause an admin password box to appear on the targeted Mac. Deny access, and it couldn't do anything. The user had to be dumb enough to allow a process to continue without thinking about why an admin box appeared from out of nowhere in the first place. While there were likely at least a few more, the official reported instances of infection by Oompa-Loompa was a grand total of 50 Macs.
For now, and has been the case almost entirely through the Mac OS’ existence, defeating malware is to use your brain. All known malware out there right now are Trojans. You have to download and install it. Gatekeeper recognizes some apps and will stop them from running, also posting a warning to delete the app/installer. Anything else will blow right through no matter what AV software you're running, or how many. They are useless. They are designed to try and stop automatic processes, such as the thousands of such viruses in Windows. Trojans bypass all of this. You choose to manually run an installer or app. It doesn't matter where it came from. The OS and AV software can only do so much to protect you from yourself. When you choose to run an app, either can only sit back and say, "Well, okay. You're the boss." Either may detect a problem after the fact, but it is of course too late, then.
The only thing you can truly call a virus that still exists are Word and Excel macro viruses. And those are almost 100% Windows malware. That is, the macro can't do anything to harm a Mac since the payload only runs on Windows. And unless you've changed the default settings in Word or Excel, if you happen to get an infected document sent to you, the macro can't run until you allow it (either will warn you the document contains a macro and gives you the option to run or block it). They fall under the virus category because if you allow an infected macro to run, all macros are automatically stored in the Normal template. Good or bad. After that, every new document you create carries the macro virus since they all start from the default template.
At this time, all AV software is nothing more than a drain on system resources. If you’re thinking is to be preventative against new threats, that is also a waste of time. No system can stop the unknown. If you download and run a new, unknown threat, neither the OS or AV software will see a problem with it since it isn't recognized.
There are numerous topics on these forums alone that prove how pointless AV software is on a Mac. My favorite? The person had three different types of AV software installed and running. And yet, an EtreCheck report showed their Mac was loaded with adware and other garbage. Yeah, the AV software was working just great!
Reportedly, a virus that could affect the Mac OS has been created in research labs where they look for flaws in the OS, then report their findings to Apple and Microsoft so the OS can be patched before crooks find these same openings. No Mac OS virus has ever been seen in the wild. At least, not yet.