You can try to place the images to different layers in Photoshop and let the upper layer have blending mode Difference. That makes black all those pixels which are same in both images. The black area can be selected and used to generate a layer mask for the image which contains the interesting target.
In theory it should be perfect. It will work exactly in an experiment where the target is inserted to the background image in Photoshop without having 2 separate shots of the scene. In practice it's not so easy because the light can be different or the background isn't 100,0000% stable or the camera can have moved. Or the camera simply processes differently different shots with its automatic enhancement methods.
Here's the mentioned artificial experiment. Sharp edged letter A is drawn to a copy of the background layer:
Blending mode difference gives this:
Both layers are duplicated, the duplicates are merged, the result is copied to the layer mask of the image which had got the A. The levels of the mask are just under adjustment with Curves to make everything non-black white and to keep black as black. Curves are used to make smooth transition zone to avoid jagginess:
I guess the target itself far too easily affects the light on the background so much that the difference near the target in the background area is far from zero. That can compensated in the curve adjustment phase if the difference still is less than anything in the target area.
Quick selection tool is extremely clever item in Photoshop. With it you can probably make a good selection from the difference image even if the black area is too far from black. But that's manual tinkering like the bg removal unfortunately often is.
This old case Use empty background image as reference for product cut out is more difficult. The blank background image is a little different than the bg+target image and the difference has much nearly zeros also in the target area. Something was still got extracted.
GIMP has more blending modes than Photoshop. If you can try GIMP try blending mode Grain Extract instead of Difference. It will pick what's different.