I have had a similar issue with remote controls before. Just for completeness, I've already listed two things you've already tried -- they're primarily for anyone who reads this some time in the future.
Replace the battery
You already know this one, but it's the easiest and most typical fix. It's also pretty inexpensive, so a good thing to try. If you get the same symptom with a fresh battery, verify that the battery really is fresh by measuring the voltage if you have a voltmeter.
Make sure you're on the driver's side of the car
Many cars have the receiver mounted to optimize reception from approaching the driver's side door. There's often a big difference in performance (distance between you and the vehicle) depending on which side of the vehicle you approach.
Check the locking mechanisms in the doors
Usually, if you're close enough to the vehicle, you can hear the "click" of the lock solenoid. If you hear that but the door doesn't reliably unlock, the problem is much more likely to be the locking mechanism in the door rather than either the transmitter or receiver. Verify by using the electronic locking buttons within the car to see if they reliably lock and unlock the doors. If not, sometimes all that's required is a little lithium grease on the locking mechanism ... after you've spent an hour or so taking the door apart.
Clean the contacts
Many remotes use a carbon "button" embedded into a flexible membrane. It is intended to contact a small matching interlocking comb pattern of copper (or sometimes carbon on copper) on the circuit board. Sometimes these carbon buttons will fail due to dirt or moisture or corrosion so gently cleaning them (and any other contacts, such as the battery) with a pencil eraser will fix the problem. (BTW, this same trick works on many TV remote controls.)
Touch up solder joints
If you have a soldering iron and know how to use it, you might try touching up the soldered joints in the remote, especially the ones for the battery and for the antenna (if the antenna isn't part of the circuit board).
Tune the transmitter
This is somewhat advanced, but with a garage door opener I once had, one of the remotes worked well and the other didn't. I opened up the poorly performing one (after doing all of the above steps) and adjusted a trim capacitor on the board for maximum output signal from the RF oscillator as measured with an oscilloscope with built-in frequency counter. If you don't have access to such equipment, you'd be ill advised to try this. Twiddling adjustments manually without instrumentation is only likely to make the problem worse.
Replace the remote
If you can get a dealer to verify that there is a performance problem with the remote, they might be willing to replace it, depending on the warranty status of the vehicle. Otherwise, be prepared to pay what seems to me to be a lot of money for a replacement. A recent replacement keyfob for my daughter's 2013 Fiat cost $300.
Replace the receiver
This is almost always difficult and expensive and is listed last for those reasons. On modern cars with security features tied to the particular car, this will likely require dealer tools that you don't have and can't easily buy. If none of the steps above worked, I'd probably report it to the dealer and hope that either it's a known and covered defect that the dealer will replace for free or that my wallet survives the beating.