This is a good read: https://www.britannica.com/topic/international-law/States-in...
The TL;DR of this is, ultimately, that a state is whatever other states say is a state, and they're generally wary of recognizing anything disputed. There's a fair bit of nuance there though so it's worth a proper read. And, as we know from Ukraine, even when the state is widely recognized with well-established borders, you'd better be in a position to enforce those borders by force if your neighbour decides they disagree.