Test if the issue occurs in Safe Mode.
Use Ctrl+Alt+Del to get to an alternate login screen
Ensure your system is up to date:
Settings > Update & Security > Windows Update.
Is the "p" key working normally once you're logged in?
If the problem persists, you might want to check the Windows Event Viewer for any keyboard-related errors around the time this occurs.