Microsoft provides detailed guidance regarding the migration - follow https://video2.skills-academy.com/en-us/entra/identity/hybrid/connect/how-to-upgrade-previous-version
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin