Begin with a forced-restart of your iPad - as this may clear an isolated software issue:
Force restart iPad (models with Face ID or with Touch ID in the top button)
If your iPad doesn’t have the Home button, do the following:
- Press and quickly release the volume button nearest to the top button.
- Press and quickly release the volume button farthest from the top button.
- Press and hold the top button.
- When the Apple logo appears, release the top button.
If the problem doesn’t clear, given that the problem is repeatable with a second pencil, your iPad may have a hardware problem that will require investigation.
You would be best advised to visit the Genius Bar at your local Apple Store or Apple Authorised Service Provider (AASP) - where the technicians will be able to test and assess your iPad and Pencil(s).
Genius Bar Reservation and Apple Support Options - Apple