Because Apple likes to make proprietary hardware you always want to make sure that the Apple hardware is 1.)Compatible with the hardware you want to replace it with 2.)The MAC or Apple product even ALLOWS hardware replacements (see MACBook Pro 2016 versions) and 3.)Make frequent backups with TimeMachine before initiating any type of replacements.
You could find a lot of information on this website such as the model + year of release of each and every MAC & Apple products to date!
https://everymac.com/systems/apple/index-apple-specs-applespec.html