Page numbers are embedded into the file when you convert a book to KFX format. This differs from AZW3 which use a separate APNX file created when the book is sent to a Kindle device. The software that supports each format uses different algorithms for automatic page number generation that produce different page counts.
In order to have the page counts match you need to use the same source for both. You need to create a custom column to hold the total page count for each book and populate it using the
Count Pages plugin. Then you can configure the KFX Output plugin and the Kindle device driver to use that column as the source of the page count. The exact numbering of where each page starts will still not match exactly but it will be much closer.
In the KFX Output plugin configuration the custom column name goes in "Lookup name of custom column with desired number of pages". In the Kindle device configuration the "Custom column name to retrieve page counts from" field is used.