Many applications store different parts of the site in different places. Website code, themes, plugins, and uploaded media are usually files, while posts, settings, user accounts, orders, and other application data are often stored in a database.
Restoring only the files may leave the site connected to newer or incompatible database data. Restoring only the database may reference files that no longer exist.
For a consistent recovery point, keep file and database backups created as close together as practical, especially before application upgrades or major site changes.