It is good practice to use a LTS distro and keep updated, but if you have an old version that reached the end of life (EoL) and can't be upgraded normally you can try the following (you'll need to have root privileges to attempt this, if not ask for help):
update /etc/apt/sources.list to:
deb http://archive.ubuntu.com/ubuntu CODENAME main restricted universe deb http://archive.ubuntu.com/ubuntu CODENAME-security main restricted universe deb http://archive.ubuntu.com/ubuntu CODENAME-backports main restricted universe deb http://archive.ubuntu.com/ubuntu CODENAME-updates main restricted universe
where CODENAME is the name of the disto you're trying to upgrade to.
Then try the following:
apt update apt upgrade apt dist-upgrade
Might well have encountered an error, some combination of rebooting/apt autoremove/ apt upgrade --fix-missing should fix things. Worst case you might have a package that refuses to upgrade, you'll need to purge this.
If everything finishes okay check:
Hopefully, you'll have successfully upgraded (or successfully broken a working machine).