This is a peculiar issue you're encountering, and it sounds like your Apple Pencil is functioning normally outside of the Photos and Files apps. Let's try a few troubleshooting steps to address this issue.
First, let's try to rule out any software-related issues. Restart your iPad if you haven't done so already. This can often resolve any minor glitches that might be happening in the background. If the problem persists, make sure both your iPadOS and the apps you're having trouble with (Photos and Files) are up-to-date. Software updates often include bug fixes that could solve the problem.
If the issue remains, try to reset your Apple Pencil. This can be done by unpairing and then re-pairing it with your iPad. To unpair, go to Settings > Bluetooth > tap on the 'i' next to Apple Pencil under My Devices > Forget this Device. Then, to re-pair it, just plug your Apple Pencil into your iPad's Lightning port and follow the on-screen instructions.
If all these steps don't help, it could be a specific issue with the PDF file you're trying to draw on. Try drawing on different PDF files or photos and see if the problem continues.
References:
- Restart your iPad - Apple Support
- Update your iPadOS - Apple Support
- Reset your Apple Pencil - Apple Support