I want to use music I heard on YouTube in my world to play in the background. Is that ok, legally? Should I credit the artist somewhere in the world?
Hey. You should probably use a video player that plays the youtube video (you can hide the screen itself to leave sound only), instead of putting the copyrighted track into your world directly.
It depends on the copyright that the author has chosen for his / her music. If author decide to allow copy and redistribute with no registration or payment (like here: CC BY 2.0) then yes, it is legal.
Want to remind that some VRChat users / players are streaming and they can get ''Copyright Strikes" on the platform they are streaming when they join your world. Therefore, it is recommended to turn it off by default and let to manually toggle.
I wouldn’t suggest it. It’s better to use copyright/royalty free music or music you have permission to use.