The workerUrl of the Worker component from react-pdf-viewer expects an URL, but you tried to assign an imported file.
You should provide the URL of a valid pdf-worker.js file, i.e. the version of the worker must match the used pdfjs version.
You could use an own URL under your domain, or the URL from unpkg.com, or from cloudflare, or anywhere else, but you can not just import it as you did.
To host the pdf-worker.js file yourself you need to make it available under some specific URL under your domain. How you do that, depends on your environment. E.g. you might need to put it into a designated folder called /public, or /static, or create a specific route in some config file, or something different. Find out how you are supposed to host static or public files in your enviroments or frameworks.
You can copy the correct pdf-worker.js file from anywhere (so that you then can host it under some URL), but as you already have pdfjs-dist, you should find the pdf-worker.js file (or pdf-worker-min.js) somewhere under that folder (which is under the node_modules folder), and can copy it from there.
See also: pdfjs - What is a fake worker?