Hi Christine, So sorry to hear about troubles with your pear tree. I don't have a great answer for you but I'm sure someone will come along soon who has a lot more knowledge and can probably help you.
In the meantime this might be somewhat helpful..... I added a dozen fruit trees to my food forest in this last year. They are all doing really well except for my 2 cherry trees. Their problem was similar to yours but mine is a bit different, it effected the tips of all the branches, just not quite so drastically.
Since it definitely looked like a disease or a fungus I did what I always do, I went online and looked for a good extension service for the answer. Every state in the country has their own universities which each have their own extension services for all things agricultural. Some are much better than others. Here in Arizona our extension service doesn't seem to do any independent research, leaves a lot to be desired and is never helpful but lots of them online are terrific.
So I typed in 'diseases of cherry trees' and added .ext or .edu to find the extension services first and then I look at 'Images' to try to find the picture that looks like my tree. Lots of them like Purdue University or the University of Michigan are excellent! There are lots of great ones. That's a good place to start.
When I typed 'diseases of pear trees, branches turning black and dying .ext .edu' these are just a couple of the websites that came up....
https://pnwhandbooks.org/plantdisease/host-disease/pear-pyrus-spp-pseudomonas-blossom-blast-dieback
https://www.purdue.edu/newsroom/releases/2014/Q2/deadly-fire-blight-in-flowering-pear-trees-still-a-problem.html
As for the 'weird stuff on the trunk of the tree'... I think I can answer that question. In all the research I did for my cherry trees I found this same answer dozens of times. When a tree is stressed it will often exude 'GUMMOSIS' from it's trunk. You can look that up too. “gummosis on pear tree. It is a sign that the tree is stressed. According to the experts, trees exude gummosis over practically anything that stresses them, too hot, too cold, bugs, diseases etc.
In the end I could never get a definitive answer for my cherry trees unless I take cuttings and send them to a lab for diagnosis but it looks like they have a bacterial canker, 'Pseudomonas syringae'. My van cherry overcame it and is starting to do much better but my bing cherrry is exuding lots and lots of gummosis and probably won't survive this winter.
Hope this helps and isn't too depressing. And I'm sure someone will come along with a better answer for you. Best of luck.