NOTE: Recently switched back to using pyenv so I can run multiple python versions without losing my mind. It only takes a few minutes to set up, but provides the flexibility I need without making things too complicated. See my gist, Manage python versions on Linux with pyenv for more.
The deadsnakes PPA make the latest stable versions of python available on Ubuntu 18.04 LTS (3.9 is already in the official apt repo for 20.04). I now find it preferable to installing from source.
The following was tested on a Ubuntu 18.04.5 LTS desktop with python 3.6.9 as the system python version ("python3").
The latest python available from deadsnakes as of July, 2021 is 3.9.6.