If enough people do it then yes it will hurt companies or whatever you are boycotting.
On a personal level it can help you, as you know that whatever it is you are buying at least doesn't support whatever it is that you are boycotting. I boycotted Chinese products once due to the Uyghur genocide thing I then believed in, and it felt good knowing that I wasn't funding a thing which I thought to be wrong.
It's just another tool. Its context and implementation decide if it's useful or useless
Targeted boycots are useful, becuase then the lower sales are directly corresponding to political pressure
imo they seem pretty useless, but i participate anyways just in case.
Plus i dont think i have ever seen a boycott for a cause i believed in that wasnt about some dumb shit that i could easily cut out of my life, like when people started boycotting fast food companies in support for Palestine i was basically already there and like i haven't bought missiles from Lockheed Martin in ages so i can give them up pretty easy too.