What are the three letters in the serial number? For example "NRR 000", "NRR" would be the letters.
Winchester target ammo should work fine, but if you shoot American Eagle or Speer Lawman and the problem still occurs, the problem is definitely not the ammo. Make sure to hold the pistol firmly in place as you shoot, "limpwristing" which is not holding the pistol in place firmly enough can cause failures to eject like you experienced.
There's a problem with some recent production Glocks that can cause ejection problems no matter how hot the ammo is loaded or how firmly the pistol is held. Next time you go shooting, pick up the spent casings(after they cool down, they may burn you if you pick them up right away) and look for markings similar to this:
The marking is a usually triangular dent/scrape at the case mouth of the spent casing that can range from being very small to very big. The markings will occur on as few as 5% of the casings to as many as 100%. If you see those markings, your Glock has the problem which causes erratic ejection. Glock has a new ejector which will fix the problem, but they're only installing the new ejector into Gen4 models. If your G23 is not a Gen4, there's nothing you can do at the moment to fix this particular problem.
I have a Gen3 G27 which has that ejection problem. I plan to wait until the latest Gen4 trigger housings with the new ejector are sold by online retailers, I'm going to take the ejector out of the Gen4 trigger housing and put that ejector into the Gen3 trigger housing for my G27. Currently no online retailer has the Gen4 trigger housing with the new ejector.
Here's what the new Gen4 .40 ejector looks like:
Glock Talk - View Single Post - My Gen 4 Glock is off to Smyrna (Gen 4 19 & 23 owners should step inside)
If your G23 is a Gen4, you can call Glock and tell them about the problem. Tell them you heard there's a new ejector for Gen4 which will fix the problem and you'd like them to install it. If they agree to install it, they'll want you to send the gun to them so they can install it. They usually offer a prepaid shipping label, but if they don't offer one, be sure to ask for a prepaid shipping label. You should get the gun back a few weeks after sending it in, and it should function and eject reliably with just about any ammo you shoot.
I just read through some of your other posts and you said that your G23 is a Gen3. If yours appears to have the erratic ejection problem evidenced by the markings on the spent casings as in the picture above, you could still call Glock about the problem, but they may not give you a prepaid shipping label and they may not do anything to fix it. You may have to do the same as I and wait for the new ejectors to be sold in the newest Gen4 .40 trigger housings sold by online retailers, buy one of those trigger housings as well as a spare Gen3 .40 trigger housing and put the new ejector into the Gen3 trigger housing for your G23.
To remove the ejector from a trigger housing, you pull the ejector out like this and install it just the opposite. You may need to use a pair of pliers to grip the metal ejector firmly enough. The trigger housing must be removed from the frame to remove/install the ejector.
You'd pull the new ejector out of the Gen4 trigger housing, pull the ejector out of the spare Gen3 trigger housing, and put the new ejector into the Gen3 trigger housing. If you do this, you should buy a spare Gen3 trigger housing because if you accidently damage the Gen3 trigger housing it's best to accidentally damage a spare part rather than the one that came out of your gun.
Remember, currently no online retailers sell the Gen4 .40 trigger housing with the new ejector. If you order one, it will likely have the old ejector. You'll have to wait until someone posts on the forum that they bought one and it had the new ejector.