If the firearm has an upper and a lower receiver, what do you do when they both have serial numbers and not matching?
That is something that is highly situational, and should probably be resolved (if you're lucky) via a determination letter from the ATF.
An example that came to mind immediately, for me, was older Marlin lever action rifles.
Most of the time, Marlin put the serial number on the receiver. Sometimes, they put the serial number on the 'trigger plate' (lower tang and the bottom of the receiver). Once in a while, they put the serial number on
both parts.
Several guys have gotten determinations from the ATF, in regards to proposed modifications, stating that removing the lower tang serial number from a rifle with dual serial numbers would be considered 'obliteration' and, therefore, would be illegal.
Other guys have gotten determinations from the ATF stating that removing a non-matching serial number from the lower tang is perfectly fine.
And then there are the guys that want to assemble a rifle from a combination of parts, that would end up as a rifle that has
no serial number. In at least one case that was documented on the MarlinOwners forums a few years back, the ATF told the guy that he'd have to file a Form 1, because he would be manufacturing a "new" firearm. They told him that transcribing the serial number from the original lower tang onto the upper tang would not be acceptable.
...It's the ATF. They don't want to tell you what you should do. They just want you to do it, and then tell you it's illegal after the fact.