You can, but I would advise to not do it right now. As most packages will be updated to newer versions like PHP 8.1 and Nextcloud(23) as of now does not support it. Maybe Nextcloud 24 will have support for PHP 8.1, I can't confirm that though.