The verse that speaks the most directly to this question is Hebrews 13:17, “Obey them that have the rule over you, and submit yourselves: for they watch for your souls, as they that must give account, that they may do it with joy, and not with grief: for that is unprofitable for you.”
Pastors are hurt deeply to see people ignore the counsel of God they share in messages or Bible lessons. Some people “blow off” the Word of God, doing so not only to their own hurt but also to the hurt of those who are around them. Young people especially have the tendency to ignore the counsel of those older than they, making the mistake of trusting their own wisdom as well as their own heart. God states that a godly pastor shares precepts from God’s Word because he desires not only to serve God but to feed the flock the spiritual food that will result in their experiencing the abundant life Jesus promised (John 10:10b).
On the other end of the spectrum, the Bible gives warning about “false shepherds” who do not have the welfare of the flock at heart but are more interested in maintaining control or exercising lordship over others, or who fail to study the Word of God and end up teaching men’s commands instead of God’s. The Pharisees were guilty of this during Jesus’ time. There are numerous examples of this in the prophetic books of the Old Testament. And there are repeated warnings about this in Acts, the epistles, and Revelation. Because of the unfortunate existence of these self-seeking leaders, there must also come a time when we disobey man in order to obey God (Acts 4:18-20). However, accusations against a church leader are not to be lightly launched and need to be substantiated by more than one witness (1 Timothy 5:19).
Godly pastors are worth their weight in gold. They are usually overworked and underpaid. They bear greater responsibility than medical doctors as Hebrews 13:7 states—they must one day give an account of their ministries before God. First Peter 5:1-4 points out that they are not dictators, but lead by their example and by their teaching (1 Timothy 4:16) in humility of heart. And like Paul, they are like nursing mothers who truly love their “children” and are willing to give themselves for their flock and rule with gentleness (1 Thessalonians 2:7-12; John 10:11). They are characterized by sincere devotion to the Word and to prayer (Acts 6:4) so that they can rule in God’s power and wisdom and impart to the flock spiritual meat to make them healthy and vibrant Christians (1 Timothy 5:17). If this is a description of your pastor, or close to it (no man on earth is perfect), he is worthy of double honor and obedience as he declares the plain teachings of God.
So the answer to the question is yes, we should obey our pastors. We are also to pray for them always, asking God to grant them wisdom, humility, a love for the flock, and protection as they protect those in their care.