Do you mean upgrade or reinstall?
I have done release upgrades in multiple occasions all the way from 16.04 -> 18.04 -> 20.04 -> 22.04 -> 24.04. Usually they work fine, but of course back up your stuff first. When doing it with release-upgrade all your stuff is of course kept just like before.
Basically just:
sudo apt update
sudo apt dist-upgrade
sudo reboot
sudo do-release-upgrade
This will upgrade to 22.04. After upgrade just repeat process to upgrade to 24.04