Website speed can matter for long tail keyword traffic, but it depends what you mean by speed. Obsessing over PageSpeed Insights scores and Core Web Vitals reports usually will not help you rank for long tail keywords. Speed is rarely the reason one relevant page outranks another, unless a competing site is so slow that users get frustrated, bounce immediately, or pogo stick back to the search results.
If speed reports were a major ranking lever on their own, sites could prioritize lightweight pages and outrank better, more relevant content, which is not how search results tend to work. For long tail keywords in particular, rankings are driven much more by relevancy, topical authority, and whether your page matches the intent behind the query.
That said, you should still audit your site from a practical perspective. Load your pages on mobile and desktop, click around, and use the site like a normal person. Do pages feel noticeably slow or glitchy? Do images or scripts delay the main content? If the experience could cause users to bounce or pogo stick, then speed becomes important and worth fixing.