The question of whether or not an organism feels “pain” is, to my mind, a red herring.
Every living organism must respond to its environment, and there is necessarily a higher priority placed on environmental stimulus that indicates immediate harm. As a result pretty much all organisms react to harmful (eg. ‘painful’) stimulus in a manner that cannot reasonably be separated from a pain response, even if said organism lacks pain receptors (nociceptors). This holds true for all animals, including arthropods, as well as plants and microorganisms.
Several big problems are that historically the experience of pain has been linked with consciousness (which is part of why there has been a resistance to admitting that other creatures experience something akin to pain) and that we lack the necessary knowledge and vocabulary to assess exactly what and how pain-like responses work in other organisms.
Baluška has argued that plants feel something akin to what we call ‘pain’ despite lacking the receptors and neural architecture that makes the experience possible in animals, and others have pushed back on that idea. The Draguhn, et al 2021 paper Anesthetics and plants: no pain, no brain, and therefore no consciousness covers this debate well.
I think that both sides of this miss the mark, as do questions of where the ethical line lies.
Living things eat each other, and the concept of ethics is a human construct (albeit one that has a decently widespread foundation in mammals, especially vis-a-vis “fair play” and equitability as the work of Frans de Waal and others indicate).
Rather than debating where the ethical ‘line’ is, we should be treating all organisms with respect. That doesn’t mean we don’t eat them, or don’t prune plants, or don’t kill mosquitoes, but it does mean that we should avoid doing intentional harm to other organisms as much as possible, no matter where they rest on the tree of life.