The full-upgrade command performs the function of upgrade but will remove currently installed packages if this is needed to upgrade the system as a whole.
sudo apt full-upgrade