Google's John Mueller said that changing from www to non-www for your domain shouldn't change much. I suspect he means that doing that wouldn't hurt or benefit your rankings that much and Google will likely pick up on the change and the rankings would not suffer much from the change.
John was asked:
We have a large site and had to change the domain url (remove www. ). The Dev guys chose to implement 301 via User Agent “Mozilla”. I expected some impact but it seems to be getting worse over time (3 weeks now). I’m now wondering whether Google recognises this for of 301 when ranking pages?
John responded on Mastodon:
Server side redirects (like 301) don't use user-agents, so I suspect you misunderstood something there :). Changing www / non-www doesnt' really change much, so if you're seeing bigger changes, that would likely be something else.
In general, changing from HTTP to HTTPS or WWW to non WWW, these types of changes, Google is very quick to pick up on these changes and rankings should not suffer from those types of changes. It is when you change some URLs, URL structures and parts of your site that Google is slower to react with.
Forum discussion at Mastodon.