Yes that's the recommended path.
Information on how to upgrade can be found in the official documentation:
https://www.debian.org/releases/stretch/amd64/release-notes/ch-upgrading.html
https://www.debian.org/releases/buster/amd64/release-notes/ch-upgrading.html
https://www.debian.org/releases/bullseye/amd64/release-notes/ch-upgrading.html
https://www.debian.org/releases/bookworm/amd64/release-notes/ch-upgrading.html
As others pointed out it might be a PITA. Depending on your installed software and configuration a new install might be easier.