Yes. The New Testament does not have a category of loose cannon, unaccountable prophets wandering around delivering messages. Such “prophets” have certainly appeared in church history, but always to the detriment and damage of the church. God calls all Christians, including prophetically gifted ones, to submit to duly appointed local church leaders (Hebrews 13:17; 1 Corinthians 14:37–38). And in the case of prophecies, we also submit to the evaluation of our brothers and sisters in our local church (1 Corinthians 14:29–33).
Now, if you sense God has laid a text on your heart for a friend, your pastors will not object to your encouraging someone else with the Scriptures. But if you think the Spirit may have given you specific revelatory information regarding someone else, you should seek the blessing of your pastor-elders before sharing it. What this looks like depends on the preference of your leaders. The point is this: make sure to test specific information first — and this is all the more true the less experienced you are in using this gift. The more you demonstrate consistent accuracy and upbuilding of others to your pastoral leaders, the more they will trust your judgment. But you should not be regularly exercising what you believe is a prophetic gift without their knowledge and blessing.