The tip of the Apple Pencil is a consumable part - that must be replaced as soon as wear becomes visible.
As described, either the replaceable tip is not properly screwed into position, or the transducer beneath the pencil tip has been damaged.
Ensuring that the pencil tip is tightened firmly into position; if only slightly loosened, the Pencil may not work as expected - if at all. When correctly tightened, you should see a tiny gap, of about the thickness of a sheet of paper, between the tip and pencil body.
If the problem persists, consider visiting 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:
Genius Bar Reservation and Apple Support Options - Apple