Why does my nexus 6p goes black after call is answered
Your phone has an hardware issue. The proximity sensor is broken or is covered.

But before, did you put a screen protector, such as tempered glass, may it doesn't have  proper cutouts.

As a workaround, I'd suggest you set up the power button to end calls (Settings -> Accessibility -> Power button ends call).

You should consider taking the phone to a repair center if the above don't work.