As for legal action it's hard to say. Legislation on this seems to be crawling at a snail's pace, but you should always review that the law says in your juristiction.
You may run a greater risk of getting contacted by lawyers if you're profiting from said music, though I doubt it's really going to a problem in practice. I mean, there's some much content being generated already that it seems like a sisyphean task trying to sue everyone, unless you clearly make a ripoff and they find out.
I would say, don't worry about it for now, but definitely check the laws where you live (hopefully with an actual lawyer), and if you publish something, make sure you also publish some way of people to officially reach you like an email, so you have a greater chance of getting a cease and desist instead of outright sued.
As for tools, I've been messing with Udio, lately. It's pretty good in my opinion. Right now it's free, but it's on beta. Once beta is over, they are definitely going to commercialize it.
There's also Suno though I haven't tried.
Good luck your projects!