I can't seem to figure out how to lock my screen when I answer my phone so my cheek isn't constantly hitting the buttons. It's a Samsung Note 4. It doesn't always do this it's pretty random.
There's no setting for this. The proximity sensor located near the top of the phone senses when the phone is near your ear/head while on a call. Sometimes the sensor goes bad, but it could also be the phone is dirty/grimy in that area, or hair might be getting in the way. Always make sure the phone is held close to your ear while you're talking.