Phones that run mainline Linux are seldom. The only ones that come to my mind are PinePhone Pro (outdated hardware, 400 bucks) and Librem 5 (also outdated hardware, incredibly expensive 1300$ !). If you are serious get the PinePhone Pro. But expect pitfalls because you can't just run Android apps.
Nextcloud is still the best option for self hosted cloud services.