In case a layered image has been flattened (and possibly further damaged by applying lossy compression) and no previous version is available anymore (either in Photohsop’s History, if the file has not been closed yet, or as a back-up) the original Layers are destroyed.
And one can, to put it a bit pompously, get them back no more than one can get a grain of wheat back out of a cake (unless in very specific cases, basically simple graphic designs).
It may be possible to re-select/clip the pertinent elements, neutralize the edges, fill obstructed backgrounds with Generative Fill or Content-Aware Fill etc. and depending on the subjects and needs this may suffice but the actual original and destroyed content remains gone.
If Type Layers have been destroyed Illustrator’s Window > Retype (Beta) might prove helpful.
Please pot screenshots including the pertinent Panels or the image itself to clarify the situation.