As per Wikipedia python 3.5 support ended on 2017 aug. Python 3.8 and python 3.9 are new versions.
My application deployed on ubuntu 16.04 with python 3.5 version and postgres 9.6
However application runs fine but Shall i need to upgrade to new version of Ubuntu with new version of python 3.8 or 3.9?
Would there be any challenges or what steps I need to follow to make sure application not break upgrading to higher version of operating system (ubuntu), programming language (python) and database (postgres)
Test your code in a Python virtual environment. You can install whatever Python version and Python packages your want in a Python environment without root privileges and without breaking other packages. That's the easiest way to test your code without breaking anything and without upgrading to a later version of Ubuntu.