Google offers some guidance on URL best practices found here, https://developers.google.com/search/docs/crawling-indexing/url-structure.
In general, hyphens are a good solution for word separators in comparison to the alternatives. Spaces can be used but must be UTF-8 URL encoded which is ugly and difficult for a human to replicate. Underscores are another common solution but can disappear when the URL in also underlined which is the default formatting for URLs in most applications.