I suspect you wouldn;t find out until you try and advise DVLA of the new engine number.... but then the same is true of buying a frame with no logbook.
If you are buying from a genuine seller, who is breaking a bike for spares, it ought to be possible and entriely reasonable to ask to see the logbook to verify frame and engine numbers match.
If you are buying an engine on it's own, bought as spares or whatever.....then you are pretty much reliant on the integrity of the seller.