SEO director at Journey Further and co-owner of MRE Media - technical SEO consultancy for start ups and SME organisations.
This is a very common problem and can be described as being an issue with 'canonicalisation'. Essentially, you only want to show one (or canonical) version of your web content to search bots as opposed to multiple versions across varieties of URLs e.g. www.domain.com, domain.com, https://domain.com etc.
This problem can be solved in a selection of ways:
Canonical tag - use the canonical link element referencing the preferred URL.
Permanent redirects - use a 301 redirect to the preferred URL.
Set your preferred domain in Google Search Console - this is the easiest, due to the lack of dev time required and seems to suit your specific issue.
It's highly unlikely that moving web hosting would impact your rankings. However there are a few situations where your visibility could decrease if not accounted for:
During the move the website isn't available for a sustained period - crawlers won't be able to reach the content on the website causing your rankings to decreases over time.
If your server response time increases - make sure your new hosting is to the same performance standard, slow load times DO impact rankings.
HTTPS encryption - if your current website has a SSL certificate you will need to ensure this is updated/retained for your new server to retain the (small) existing ranking benefit.