When I change the sorting of my contacts over contact properties from default display name i. e. to last name the sort changed. It will be held even if I switch beetween apps.
But when I log off and log in again, the attitude is back to the default display name.
As far as I remember your the contact sort setting is stored on your local PC using a cookie and not on the server. Most likely you are deleting your browser cookies which could cause the monitored behavior. Have you checked this?
I checked that. There is no cookie set for my nextcloud domain when I change sorting. And when I do a log off and log in, I didn’t close my browser so the cookies won’t be deleted, if there is one. But there is no additional cookie set.