It is hard to say. Unless the part seller specifically mentions it, then I would say it is not compatible. Usually knowledgeable & reputable part sellers will clearly list the systems a part is compatible with. Just make sure you are using a reputable seller and they are knowledgeable about the part they are selling. I know with older Apple laptops two screens can look identical...mounts line up, cables all fit, but the parts are not compatible. If you are lucky, nothing bad happens. If you are unlucky, then you may burn out the replacement Display and the Logic Board if they are not compatible. Even an AASP may not be able to give you a definitive answer since Apple can change part numbers on them even if they are exactly identical parts.
Keep in mind that with the 2018+ Macs that Apple does a special pairing of components so you may end up with a less functional Mac...in what ways I cannot say since Apple doesn't really provide any information. I do know Apple has said the pairing of a Display is to calibrate with the Logic Board for HDR. Another possible side effect may be that DRM protected content may no longer play on your laptop due to HDCP being broken because the Display is not properly paired. There is also a possibility that not pairing the Display could affect the security level of the Mac where maybe something like the Apple Wallet or other things in that vain may no longer work (I'm not saying the Display is a security risk, only that not having it properly paired may have macOS tell itself there is weakened system security).
A few years ago I was working on a Mac and something refused to operate due to an issue with the perceived security level....it ended up being some simple macOS setting that affected it, but I would never have considered to have any bearing on affecting security in that way.....I don't recall the specifics, but it was really a stretch to figure out a valid link why that seemingly innocuous setting would have prevented that feature from working due to security reasons....I really wish I could remember the exact details.
Apple or an Apple Authorized Service Provider may refuse to repair the laptop later on if they suspect an unauthorized repair has been performed. Just because the part may fit & work, does not mean it is the proper part for that specific model laptop...so if Apple discovers this discrepancy (techs that are very familiar can tell the difference many times, plus the parts are scanned), you may no longer receive official repair service (or if you do, then it will be even more expensive since Apple or the AASP will not be able to exchange parts which means you will not get credit for the core return in the exchange...this usually doubles the price of the part, but most AASPs don't seem to even offer this option to customers from what I've heard on these forums from other users who have been refused service). While this is not right and probably not legal in many jurisdictions, this is what I've seen reported on these forums from a lot of users and in most cases people probably don't have the time or money to actually challenge Apple in a long drawn out legal battle.
These laptops are much more difficult to work on than most other laptops. There are a lot of very fragile & delicate cables & connectors that are easily damaged even when the experienced repair tech is being very careful. One mistake, and you may be paying even more for other parts.
I am all for a person's right to repair and for independent repair shops, but people also need to know the current risks. Apple laptop's are not really made to be repaired by anyone both in design, and exorbitant part prices for highly integrated components in just a few major parts. The hardware pairing is just another added difficulty, hindrance, and annoyance. Unfortunately it is not advisable to have a self repair or unauthorized repair with the Apple USB-C laptops (especially the 2018+ models). But it is your laptop to do with as you please, but just be aware of the potential risks.
Good luck if you go ahead with the self repair.