So, in short: you should go from 9.8.0 to 9.8.3 first, then jump to the closest esr 9.11.x, at the moment version 9.11.12 and from there directly to the next (and latest) esr 10.5.x, at the moment 10.5.3.
And, of course, use the upgrade guide and the “important upgrade notes”: Upgrade Mattermost - Mattermost documentation
General release policy: Release Policy - Mattermost documentation
Changelog 9.8.x: v9 Changelog - Mattermost documentation
Changelog 9.11.x: v9 Changelog - Mattermost documentation
Changelog 10.5.x: v10 Changelog - Mattermost documentation