Apple created APFS to accommodate the way SSDs work, better than MacOS Extended (HFS+), basically - but HFS+ is still supported. But from Tahoe and onwards, macOS must be run on a APFS formatted drive.
Both APFS and HFS+ can be used on both SSDs and HDDs, but my experience is, and most reports are, that SSDs work better with APFS, and HDDs are less stressed with HFS+.
APFS came with some very nice new features compared to HFS+;
Volumes:
Kinda like partitions, but can be created in seconds, and don't have to have a fixed size as partitions do - thus, they 'share the free space'.
Snapshots:
You can create a snapshot on a APFS volume at any time, and it's like a copy of the files directory of a volume - not the files themselves, so they're small in size. Any file/folder present in any snapshot will never be overwritten - even if you drag it to the trash and empty it and they seem to be gone from Finder. That way, any file, in any snapshot will stay (invisible) on the drive, and be restorable. Once you delete your snapshots, the space used by those 'invisible' files will become available again.
I don't, in any way, have a deep understanding of these these things, but what I've written above, I'm pretty sure of, and is some of what I've learned over the last decade of going from Intel macs and HFS+ to M-series ARM and APFS.
(Btw, Any drive can still be partitioned, and partitions can be a mix of HFS+ and APFS.)