I've been using Trilium (https://github.com/zadam/trilium). There are desktop clients, no mobile clients. However the web interface works well enough for me that I don't mind. The notes update in near-realtime when you make edits through the web app on multiple machines (assuming internet connectivity of course).
If you're already self-hosting NextCloud you might want to look NextCloud Notes as well.