Tildes in versions are described in the section of Policy on versions. Basically, tildes sort before anything.
>= 3.8.2-1~ is satisfied by any version starting with
3.8.2-1, including versions with suffixes starting with a tilde themselves, such as
3.8.2-1~bpo (as would be used for backports), as long as there aren’t two tildes in a row. In fact such dependencies, with a tilde at the very end of the version (including the Debian revision), are typically used to facilitate backports.
Since this is specifically what your question is about, and isn’t addressed by Debian Policy, it’s worth going into more detail. A typical version dependency would look like
python3.8 >= 3.8.2-1, requiring version 3.8.2-1 or later of the
python3.8 package. This would be satisfiable by any later upstream version of Python 3.8, and any later Debian revision of the package (3.8.2-2, or 3.8.2-1ubuntu1, etc.). But it wouldn’t be satisfied by backports, which have versions of the form 3.8.2-1~bpo10+1; since the tilde sorts before the empty string, 3.8.2-1~bpo10+1 is considered to be less than 3.8.2-1. Backporting packages using versioned dependencies of this form thus requires changing their dependencies, which goes counter to the general rule that backports should be as close as possible to the original package.
So adding a tilde as the last character of a version in a versioned dependency helps relax the dependency slightly: it allows versions with the same prefix, and a tilde-separated suffix, to satisfy the versioned dependency. This is the opposite of the documented use of tildes for pre-releases, which result in versions which can’t satisfy strictly-versioned dependencies on the final release.
(Note that a tilde as the last character in a version number which includes a Debian revision, as given in the question, can’t allow upstream pre-releases — those would look like 3.8.2~pre1-1, which is less than 3.8.2-1~.)
Versions aren’t sorted lexically, they’re sorted by component, numerically if possible, lexically otherwise. Thus 3.8.10-0ubuntu1~20.04.4 does satisfy this relationship: 10 is greater than 2, so the dependency is satisfied and the comparison stops there.