You'd need to pull the door panel and have a look inside to see what's broke.
The lock moves a rod up or down that connects down to the lock assembly which is where the latch to hold your door closed is. Either the lock is bad, the rod is off or something is hanging up down in the lock assembly.
The handle itself is held in by two bolts accessible inside the door. I'd guess the handle is loose and something is hanging down in the lock assembly so when you turn the key instead of the rod going down, it's pushing the handle out.
I was having a similar issue where the inside door lock would hang to the point where the car would auto re-lock itself when I used the alarm to unlock it, I ended up lubing the lock assembly with white lithium grease and it solved my problem.