I am usually using the Setup Assistant to transfer all content from an old Mac to a new one.
When I install the system on the new Mac, the Setup Assistent will ask, if we want to transfer data from an old Mac or a Time Machine backup. This is the best moment to transfer Photo Libraries and iTunes Libraries, because it is done , before a new user account is created. During the first setup we can avoid problems with file ownership, when the user accounts are transferred with all data as they are. We can also inherit the Time Machine backup.
If you already set up a new user account and need only to transfer your libraries, do it by copying the photo libraries from your old Mac to an external drive, that has the file system format MacOS Extended (Journaled) and the "Ignore ownership on this volume" flag set. Copy the libraries from this volume to your new Mac. The flag is important to avoid copy errors. How to prepare the drive is described here: Move your Photos library to save space on your Mac - Apple Support