If I get the question right..... you certainly "can" change the same part number component. It has to be verified via the IPC that it "is" valid for that particular aircraft serial number (effectivity or line number).
We have found in the past that the wrong part number has been installed on a aircraft. The only way to know is by checking approved documentation.
Finding two parts with the same part number and serial number means one or both are bogus parts.
There usually is a wide variety of part numbers that are interchangeable. As with the previous statement above, everything should be verified via documentation or engineering before install.
As an example: Light Dimmer M00793.
The equipment list part number:
My company's parts search results:
As you can see, several part numbers are listed in the Equipment List. A completely different number is shown in the IPC. My company's parts data base shows numerous interchangeable parts.