I do something similar, but respond to any message from a known sender with the "I'm driving" message.
As aa6vh wrote, you only want to respond to known senders, so I check the sender's name to see if it contains a number. If so, that's someone not in my contacts and I don't reply. After that, you'll check the name to see if it's "Mary Smith" OR "John Smith" OR "Jane Smith" OR "Chris Smith" to give the "family" response and anyone else (which would be non-family contacts) gets the standard response.
One other thing you'll want to do. The person you auto-respond to just might have an auto-response set up as well. So you send "I'm driving" and they auto-respond to that with "I'm driving", to which you respond with "I'm driving", to which they respond...
To prevent that, I created a task called Circuit Breaker, that has just a 5 minute wait block. Before I send an auto-response, I check to see if that task is running. If so, I don't send the response. If it's not running, I send the response and start the task. If they should auto-respond, I'll see that Circuit Breaker is running and that prevents the loop. (Of course, if anyone else texts me in that 5 minutes, they won't get a response, but that's OK with me. You could do something more complex if you want to avoid that.)