Permission Issues

Hey there

Recently i've been facing some permissions issues on my wordpress, i went to check the user:group of my root directory and i realized that it changed from www-data:www-data to 991:988. I changed back to www-data and crashed the site so i went back to the 991:988 again, but facing some issues in some especific pages.
Do anyone have a clue of whats going on? What is the right permission and user:group to use?
Thanks in advance.
which log should i check bro?
i have a marketplace that has API integration with a payment platform and its now woking due to this permission issue, kinda super critical for me