Many things can generate an epub. You need one that passes epubcheck to go on Smashwords/Draft2Digital which gets you into Apple Books and all the even more minor bookstores. (Kindle doesn't care.)
I understand that Apple Pages outputs standard-compliant epub that can go straight onto Apple Books/SW/D2D.
Calibre does not. The Calibre authors think that epubcheck is trash and if you follow it, your books won't quite be right on the widest variety of epub readers, which is what they aim for. Beware.
When I tried Pandoc it didn't output a compliant epub, I'm told it does now.
Don't just run and hope - check the output against a variety of readers. You will hit issues.
(e.g. one I only found out about because someone just happened to use a Kobo reader.)
You may have to edit XHTML files in a .zip that has to be ordered in a particular way. (I hate epub so much.) Having done this, I don't recommend it at all. Here's my guide for people who've made poor life choices, e.g. me: https://davidgerard.co.uk/blockchain/2020/11/05/calibre-epub...
tl;dr if you have a Mac I'd just see what Pages can do for you. If not, you're gonna have fun!!