Do you mean 7800X3D (AM5)?
Because 5800X3D is AM4, so you can probably swap it with current 5600X, look at "supported models" list for your motherboard.
You can put 5800X3D inside first gen AM4 boards (B350/X370), or 2nd gen (B450/X470), it doesn't need to be 3th gen (B550/X570)...unless you...