Does anyone know what this is?

Before I go to the doctor, does anyone know why my nail does this? So basically the white part of my nail will go into the pink part and it hurts. It does if on both nails. Not all the time. I’ve tried googling it and found nothing.