After downloading the new packages from the archive:

dpkg does not resolve dependencies, instead use apt install with the path to the package(s), if they are in the current directory you can use ./ for the path. apt install will resolve any dependencies.
Following this topic the command below would install 4.0 over 3.6.
sudo apt install ./mongodb-org-server_4.0.28_amd64.deb ./mongodb-org-shell_4.0.28_amd64.deb ./mongodb-org-tools_4.0.28_amd64.deb
At the recommended point in the upgrade guide to restart MongoDB:
systemctl restart mongod
Otherwise follow the upgrade procedures as there are a few compatibility changes, removal of MONGODB-CR ,Replica SetProtocol Version 0 and Master-Slave replication. As well as deprecation of MMAPv1 databases.