It’s not recommended to upgrade directly from Matomo 3.x to 5.x. First upgrade from 3.x to the latest 4.x version, then move from 4.x to 5.x. This helps prevent errors and data loss because each major version includes important changes. Always back up your database and files before upgrading and check that your plugins and server meet the version requirements.