Em dashes (—) denote pauses, additional information, or shifts in thought, functioning like commas, colons, or parentheses. En dashes (–) relate numbers or dates, and hyphens (-) link words or prefixes. Em dashes emphasize parenthetical content; en dashes indicate ranges (e.g., dates). Hyphens also connect compound terms. Use spacing around em dashes varies by publication, but many omit spaces.
https://www.merriam-webster.com/grammar/em-dash-en-dash-how-to-use