There is a known bug with Apple's Preview and some other apps, if you are using a Mac and are on Catalina, where some links with # anchors in them don't work.
This is not a Leanpub bug, and we hope it gets resolved sometime soon, presumably in an OS update from Apple.
If you encounter this issue, please try opening the PDF in a different app, or in an internet browser. Then, the links should work.
For any Leanpub authors who encounter this issue, here is a thread from the Leanpub Authors Forum with some details: