@alex I hope you know, that a dump/restore is required to migrate data from any previous PostgreSQL major release.
https://www.postgresql.org/docs/current/upgrading.html

Also, with PostgreSQL 18, initdb creates new databases by default with enabled data checksums.
Based on this change, an in-place migration with pg_upgrade is only possible, when database running the old PostgreSQL version is also created with data checksums.