I will give an example.
My ally is in a grapple that they do not want to be in and they keep failing the checks to escape. I am a Druid with a 30' speed and I am 50' away. I can not reach them to pull them out so I run up 30' and cast Thorn Whip. My ally's AC is 22. If my ally is willing to be hit by my spell to pull him from the grapple, would the attack auto hit? Would I still have to hit 22+ AC?