I have lived this many times over. You will always have clients like this, these are the best ways I have found so far.
1: do not give net 30 day terms unless a client has earned them or applied via credit. Some exceptions can be made for large firms, but many small to medium businesses are terrible about paying. Large businesses might be a little slow, but almost always pay consistently the same, unless there is a known issue.
2: If you do give net 30 terms (or anything more then 10 days), provide a discount for payment within 10 days. This makes almost all larger businesses prioritize your invoice and get you paid. You may think it is minor, but many businesses do this over hundreds or sometimes thousands of invoices and they save significant amounts of money doing so.
3: Make payment details clear within your TOS/contract. For my smaller consulting clients, if their invoice was unpaid after 3 days from the due date I stopped all work and they lost their spot in line for services. So essentially most of those clients had 7-10 days to pay me or I halted all work. I also had it up front that if that happened 2 times within a short period (defined in the contract) that all future work (if accepted) would be prepaid. This was part of my non-negotiable contract terms. For my SaaS product, I used similar terms, we billed their credit card for small/mid sized clients (generally under $2k/month) and if their card was denied or we were unable to collect that months service after 5 days we suspend their account until it was brought current. They typically had until the next billing cycle to do so and then their account was disabled and couldn't be reactivated without talking to me. For enterprise clients on the SaaS product we used invoice terms with a built in discount and a time bomb suspension, it was just typically a little longer as I never had an enterprise not pay.
Employing those three strategies fixed most of our cash flow issues and helped stress levels go down drastically. But sadly, it never fixes all the issues so like others said, no client is better then one sucking up resources, dump them.
Also, I had clients get super upset when their accounts got suspended or we stopped working their project and they went back into the queue. But in the end, it isn't my problem, it is theirs. I would always try to empathize with them and would work with some to help out where it seemed right, but in the end, fuck you pay me. https://www.youtube.com/watch?v=jVkLVRt6c1U