It’s difficult to tell if it’s not routed correctly on your bike without a photo, maybe see if you can find a stock image of your bike online and compare with yours?
If it’s the original Factory cable outer I’d like to think it’s compression-less, but of course it may have worn out and need replacing.
If there’s friction, if it were me, I would replace the inner cable first with a good quality stainless one and see if that helps - it could be gummed up or frayed somewhere and it’s the easiest part to change. If the old cable comes out rusty or gungy I have had success spraying a little GT85 down through the outer to clean it - but if you do this make sure you don’t get any on the brakes themselves!