After following the instructions on Configure SFTP on EE4 server I was able to get connected with a user I made but I am wondering how you can use this same setup for the www-data user that is the owner of all the files and folders in the htdocs folder? I might be wrong but files created with an sftpuser account will create the file with the wrong permissions and will cause issues with WP?
Look up group read/write on a directory (chmod -R g+w). Basically, the directory is owned by www-data the user but group is different. Anyone in that group can read/write to that directory.