Delete JPG with same name as RAW files

Hello, I've scoured the forums and can't figure out how to do this. I have a folder that contains both .JPG and .DNG (.dng is a RAW image format). Some of the files are identical images saved in both JPG and DNG formats these photos are named identically other than the file extension. For example:
However, sometimes when I shoot panoramas I do not get a .DNG file and only end up with a .JPG file.
I'm trying to create an automation that scours my folder looking for all instances where the .JPG and .DNG files have the same name, and then delete the .JPG. So the desired result in the example above is to delete DJI_0001.JPG and DJI_0003.JPG and leave the rest.
Can anyone help?
However, sometimes when I shoot panoramas I do not get a .DNG file and only end up with a .JPG file.
- DJI_0001.DNG and DJI_0001.JPG are the same photo in different formats.
DJI_0002.JPG is a panorama
DJI_0003.DNG and DJI_0003.JPG are the same photo again
I'm trying to create an automation that scours my folder looking for all instances where the .JPG and .DNG files have the same name, and then delete the .JPG. So the desired result in the example above is to delete DJI_0001.JPG and DJI_0003.JPG and leave the rest.
Can anyone help?