Safari search/url bar resets on change
To me this sounds like Safari is just prompting you with a URL, either from your visited history or from popular web page URLs.

And, as it's doing this, if you press enter it's reading that as you accepting its suggestion, in which case it populates the address bar with that URL and takes you to that page.

However, on other occasions, you've typed enough of the URL for Safari to know you're entering something different, or you've typed the whole URL in which case pressing enter is telling Safari to visit the URL you've manually entered.

If this is the case, then it's not a bug, it's just that you need to get used to this behaviour. Evenso, I think we all get caught out sometimes, especially if we press enter at the wrong moment.

You can test for this by entering a URL slowly and watching the address bar  - you'll see that it's suggesting a full URL path beyond the cursor and this suggested path will change depending on what you type, but if you press enter at any point Safari will interpret that as you wanting to go to the suggested path.