I'm a noob here. I would like to know whether I will have any issues if I change ownership of
www-data, and what is the significance of
/var/www traditionally holds the necessary files to serve a website using a HTTP server such as Apache. Apache is executed by the user www-data, so interactive elements of the website (e.g., PHP scripts) have write access to pretty much everything owned by www-data.
Owning /var/www by www-data is undesirable by the principle of least privilege. There's usually no need for a PHP script able to modify itself or other parts of the website.
If, for some reason, www-data needs to be able to modify or create some files, you can grant write permissions to those specific files (for modification) or write and execution permissions to a folder (for file creation) by owning them.