I think Collabora Online
uses or is built on LibreOffice. It’s a subscription service but you can host it yourself for free (I think for personal use). I’ve not tried either. I’m pretty sure the Collabora team are big code contributors to LibreOffice. If I got anything wrong I hope someone will correct me.
Both are good, but different focuses. OnlyOffice has fewer features, but extremely good MS Office cross-compatibility.
Libre Office has more features, but can run into compatibility issues when going back and forth between MS Office.
That being said, for the average user’s needs, both are perfectly fine.
OnlyOffice is also able to be used in a cloud framework similar to Google docs, but to my knowledge Libre Office cannot do that.
I think Collabora Online uses or is built on LibreOffice. It’s a subscription service but you can host it yourself for free (I think for personal use). I’ve not tried either. I’m pretty sure the Collabora team are big code contributors to LibreOffice. If I got anything wrong I hope someone will correct me.