Privacy: can a app from App Store access my Apple ID data? Can a app from App Store access my Apple ID data (like first-name, last-name, country, email,...)?

I am interested in both platforms, iOS and macOS.
No, the Apple ID information is not available unless you manually provide it yourself. There are no public APIs available for Apple ID access.

On macOS, if you 'un-sandbox' an App Store app by granting it access to your ~/Library folder, it is then able to read the relevant plist to get your Apple ID email.

On macOS or iOS, if you grant access to Contacts, then the app is able to lookup your ‘me’ contact to find personal information. This may or may not be related to your Apple ID.

For unique device identification, identifierForVendor is available in UIKit which is a unique ID for the device, but no personal information can be obtained.