psql --version reports the client, while SHOW server_version; reports the server you are actually connected to, and the two often differ.
server_version_num packs 18.6 into 180006, so scripts can compare versions with a plain integer check.
PostgreSQL 13 is already end of life and 14 reaches it on November 12, 2026, so check your major version against the five-year support table.