Ubuntu releases are based first and foremost on the previous Ubuntu release.
For a portion of the Ubuntu release cycle, source packages which are not locally modified in Ubuntu are auto-synced from Debian. Normally this auto-sync is from Unstable but for some earlier LTS releases it was from testing instead. It is also possible for packages to be manually synced from Debian either because local modifications in Ubuntu are no longer needed or because there is a desire to sync a newer version from Debian experimental (or unstable in the case of releases where the auto-sync was from testing).
Nowadays package updates (whether from the auto-sync, manual sync or from uploads) initially go into a special section of the archive called "proposed", they only get transferred to release when they pass certain checks.
Furthermore many of the core packages in Ubuntu are locally modified and Ubuntu is often ahead of Debian on versions for such packages.