So the real issue with longbows isn't that they aren't effective. A longbow would reasonably effective if you could get a regiment to use them, the issue is maintaining a body of troops capable of wielding them.
This was difficult to maintain even in the Longbow's best time. The English crown had to outlaw other sports, and promote competitions to try to keep the population of men trained in their use. You can't decide to pick up a longbow one day and learn to use it in a few years' time. It's a lifetime of work with someone already proficient in it's use (especially since there was no way to look up videos on how to do it, or widely available books on the art.)
Even pulling a few thousand longbowmen together was a gargantuan task for the English state.
Meanwhile, once firearms become sufficiently available, you can train a decent soldier in a few months, less if all you need them to do is man a wall.
Suddenly you don't have to work so hard to maintain traditions of a niche skill, you can field huge armies on relatively short notice, and soldiers are individually much cheaper.
Could a niche role for longbowmen be found? Maybe, but you can't train longbowmen when you raise the army, they have to already exist, and all the men that historically would have been skilled archers, such as hunters and woodsmen, are using firearms.
Those sorts of men are still valuable for the army, and typically form the core of light infantry skirmisher units because they can be trusted with a degree of independent action and are skilled marksmen, but the longbow tradition no longer exists in significant numbers.