The intermittent, unresponsive touchscreen issues with higher priced, larger screen iPad Pro and iPad Air models are a well known and well documented issue, here, in the iPad support communities.
This affects a still small, but continually growing minority of random 2017 through present iPad Pro and iPad Air models and its user base.
Now, after 3 years of this nonsense, there is still no confirmed cause and fix/solution from Apple.
NONE!
Getting one of these defective units is very random and is ONLY one of a small handful of issues going on with higher priced, larger screen iPad models that has prevented me from purchasing a new iPad Pro or new iPad Air for the past 2-3 years.
Apple and Apple support have no real fixes or solutions to this issue.
If you have a screen protector on this iPad Pro, remove it as the screen protector makes the touch screen and Pencil experiences worse.
There is absolutely no solution/s to these later iPad Pro/iPad Air touch screen issues.
Apple support can only offer superficial, “band-aid” bandage-like advice/fixes/solutions.
You can contact Apple support, but your iPad Pro/later iPad Air model maybe too old for Apple to offer any type of free or in-warranty iPad replacement and Apple will ONLY offer “band-aid“-like advice/fixes/solutions to this issue.
Apple support is pretty much clueless to this issue and Apple, itself, has never, publicly, acknowledged this issue or issued any type of device recalls.
This is something you probably didn't want to learn, but doesn't change any of the currently known facts.
So Sorry & Best of Luck to You!