Is there any way to change themes or platforms without losing Google ranking?

If you change themes or even switch away from WordPress, you may experience a drop in rankings. 

This happens when something changes on the site that originally made it rank. 

To maintain your ranking, make sure to do the following:

A permalink structure binds the link displayed in Google Search results to the corresponding content on your page.

If you change it, the content will return 404 errors and eventually be deindexed.

Make sure to redirect properly all indexed pages if the permalink structure needs to be changed as part of a theme or platform upgrade.

Avoid making drastic changes to the content itself.

Content on the old theme or platform helped you rank. Switching platforms or themes at the same time as making drastic changes might confuse Google’s search algorithm.

Allow it time to adjust, and update content progressively while monitoring the ranking change.

Don’t change the content above the fold.

It is not uncommon for themes to feature a large hero image or section, which will push written content below the fold.

The content above the fold could sometimes be the reason for a page ranking. The page might become less relevant to the searched keywords if it has less content there.

Maintaining the same content is the way to go. If it must change, rephrase it to keep the same meaning rather than pushing it below the fold.

Keep existing schema markup from the previous site if it exists.

Some themes have their own schema implementation. Ensure the schema markup is ported to a schema plugin if that is the case.

Performance and other core web vitals should remain similar in any new theme or platform

The performance of the site now contributes to the ranking process.

This will not have a major impact, since its importance is less than the relevance of the content to the search query and the backlinks that support it.

However, it might influence the position in search results. 

Ensure that the new theme or platform is fast and performs better than the previous one.