How I can check whether 2 databases despite being in different postgresql servers of versions are the same?
You cannot do that in a fast way.
The best you can do is to dump both databases using pg_dump from v11 and compare the files with diff.
If you want to do that just to ensure that the migration was successful, don't. If you don't trust PostgreSQL's upgrade process, why should you trust pg_dump?