Let me guess, you use an android phone yes? There are other threads with people complaining about the bluetooth not working properly especially when using android phones. It's less an issue with the car, as much as it's an issue with how the bluetooth is working on your phone. The phone key works via bluetooth.
Your car checks for the proximity of the phone via bluetooth. If it can connect, it knows you're there, and it allows you to unlock and start the car. It also locks the door once you walk away as long as it can connect to your phone via blueooth. If your car is unable to connect to your phone via bluetooth, then these things don't work properly.
Things to check...
-Make sure your phone's bluetooth is on and doesn't go into sleep or battery saving mode.
-Make sure you don't have a background app hogging the bluetooth, something we know about bluetooth is that it doesn't work well when multiple apps are trying to use the bluetooth connection at the same time.
-Make sure you don't have anything on you or near you that blocks the bluetooth connection. These things include:
Microwave, it uses 2.4Ghz, same as bluetooth.
Your body, since bluetooth's radio frequency is blocked by water, and your body is made up of mostly water, you could be blocking the bluetooth connection. If you have your phone in your backpocket, try placing it in your front pocket so your body isn't in the way between the car and the phone. Or simply have the phone in your hand would work as well.
Wifi, yes unfortunately most wifi routers use 2.4Ghz and wifi & bluetooth could cause interference with each other. If you have this issue at home, then changing your wifi router's channel and channel width would help. You can also try to improve the situation by disabling your phone's wifi so it doesn't try to use wifi and bluetooth at the same time (some phones have difficulties doing that).
Metal, if you are using a metal case, container, suite case, etc.. your car will have difficulties connecting via bluetooth to your phone.
==
All in all, key to fixing the phone key issue is to solve the bluetooth issues.