Make sure the tip of the Pencil is screwed on securely and snugly ( NOT TOO tight! ).
Then follow all of the troubleshooting tips in this Apple Website Webpage support article.
Tap the link below.
https://support.apple.com/en-us/HT205236
Also, have you checked the tip of your Pencil lately?
Does it look worn?
Apple has a 4 pack of replacement tips for purchase.
Found here.
Tap the link below.
https://www.apple.com/shop/product/MLUN2AM/A/apple-pencil-tips-4-pack
If no joy,
You need to search online for your nearest, “local” Apple store location and call contact phone numbers and call to make an appointment to have your Apple iPad AND Pencil diagnosed and options presented you.
Failing that,
You need to contact Apple support via the contact support link located at the upper right hand corner of every Webpage of these Apple support communities.
Use the Hardware Repair, Device Performance, Connectivity support categories.
OR
by installing and using the Apple Support app found in the iOS App Store.
Tap the iOS App Store link below.
https://apps.apple.com/us/app/apple-support/id1130498044
OR
Call contact Apple via the support numbers found in the link bekow.
Contact - How to Contact Us - Apple
Tap the link below.
https://www.apple.com/contact/
Best of Luck to You!