Apple’s macOS Sonoma is the latest and best version of Mac’s Operating Systems. It comes with several optimizations and additional features. But it does not prevent you from losing data in whichever way. That said, you must take care of all your files to safeguard them from loss and overwrite.
But in case you lose data from the new version of Mac, you should not worry as there are still many ways to recover it.