iCloud is sync service. Time Machine is a backup tool.
They're both important and not interchangeable.
You use iCloud to sync content across all your devices. This way, you can access the most current version of a file, document, or photo, from any device where you're signed-in with the same Apple ID.
Time Machine is designed to create and store backups, including versions. This is only accessible from a device that locate and mount the TM backup. Nothing stays in sync across your devices.
If your local hard drive fails, you can use your Time Machine backup to restore your files and retain your version. iCloud will only allow you to sync the most-recent version of your files back to your drive, without version history.
I recommend using both of these but use, and understand, them appropriately.