Unload the gun.
Test 1. With an empty magazine in the gun, slowly operate the slide. The slide release should spring up and lock the slide to the rear.
Remove the magazine.
Test 2. Without a magazine installed, slowly operate the slide. The slide release should not spring up and the slide should be free to move back forward after it is pulled to the rear.
Remove the slide from the gun.
Test 3. With the slide removed and no magazine in the gun, the slide release should move upwards when pushed upwards but should spring back down when it is released. You should be able to feel a spring pushing the slide release down against the upward pressure you apply.
If all of that is correct, then it is likely that you are inadvertently bumping the slide release upwards during recoil when you hold the gun to fire it.
If Test 1 fails, try it with a different empty magazine. If Test 1 fails with two different magazines then the slide release is probably broken.
If the slide release doesn't have any spring tension holding it down in Test 3, then it's likely that the slide release spring is broken or improperly installed and the slide stop may be "flopping" during recoil and locking the slide open when it shouldn't.
If the slide release has upward tension in Test 2 or 3--it wants to spring upwards even without an empty magazine installed, then it sounds like the slide release spring is improperly installed and/or damaged.