I would argue that both of these are disciplines inside the space of UX Writing
that a good writer would perform for a company. I'm a freelance UX writer, and I've worked with brands like Spotify, Notion, Google and many others—and here's how I see it:
Microcopy usually refers to the specific, actionable copy for users. Things like the copy on a dialog box, a line of text explaining an error, or something as tiny as a call-to-action.
Copywriting is usually the act of writing marketing copy, and generally was what UX Writing often found itself lumped in with before.
The key difference between copywriting and UX writing, however, is that with UX writing we're trying to get the user to understand exactly what's happening—we're clear and to the point, with no additional flashy words or cheesy phrasing to get there.
It's direct, and helpful—that's it. Copywriting, generally, found itself in the awkward space for years where cheery errors might say "Oh no! Something went wrong." That's not particularly succinct, nor helpful—but it does sound nice, despite leaving the user more confused.
UX Writing became a discipline in its own right because of this blur, and because users don't really want cheesy copy—they just want to get something done. I wrote a bit more about this here in the past, with a number of examples of what I mean.