The main question that probably needs answering is, why do you require to stay on these old versions of the software? They no longer receive security updates, nor bugfixes, from anybody; and software you are running on top of it probably has updates too.
You would be best served to investigate a proper path to migrate your web application data to newer versions of software and libraries.
To answer your stated question:
In short: upgrading your distro upgrades the software to that distro's upported versions.
A distro release is comprised not just of the installer of the distro, but also the software in the repositories, for that release.
Updating a release, amongst other things, switches your software repositories to the ones dedicated for that new release.
These repositories supply the versions of applications and libraries available - of which MySQL, PHP, Apache, etc.
Older versions are not supported, as in, they do not receive bugfixes and security updates. A release-based distro's repositories carry a specific version for this purpose: for the long term maintenance, a specific version of each software (or in some cases software major series, like
php7) is targeted.
In the case of MySQL and Apache, there is typically only one version of each, the "latest", as per the distro's release guidelines. If you want a newer version, you can add a PPA.
If you want an older version, you need either to run an older distro, or compile the older version from source. Neither is advised.
So by updgrading your distro, you would be upgrading all software on it. This, assuming it is even possible to upgrade straight from 10.04 to 16.04 - you've skipped an LTS, and your version has long been EOL.