Debian

Upgrade to latest stable

Enure backups !

Ensure everything is up to date

apt update
apt upgrade
apt dist-upgrade

Check package db consistency

dpkg -C

Check hold packages

Hold packages will not be upgraded, ensure there is no deps shit

apt-mark showhold

If there is anything, check with dpkg --audit

Update source list

Check

sed s/$OLDSTABLE/$STABLE/g /etc/apt/sources.list
# for exemple
sed s/stretch/buster/g /etc/apt/sources.list

Is it's ok, go

sed -i s/stretch/buster/g /etc/apt/sources.list

Do not forget stuff in source.list.d

find /etc/apt/sources.list.d/ -type f -exec sed -i s/stretch/buster/g {} \;

Simulate

apt update
apt list --upgradable

Go

apt update
apt full-upgrade

Clean

apt autoclean

Enjoy !