This article explains how to add realistic drop shadows to images in Photoshop CC 2019 by selecting an object in the background and then moving it to a separate layer.
How to Make a Shadow in Photoshop 2023 (Quick Tutorial)
Although it may sound counterintuitive, you start by adding a drop shadow. Then, use the Free Transform tool to adjust it:
Use the lasso tool to select the object.
Right-click on the object and select Layer via Cut.