What did Paul mean when he wrote 1 Corinthians 14:22 in the context of 1 Corinthians 14:23-25? We see in 1 Corinthians 14:22 that tongues are a sign for unbelievers and prophesy is a sign for believers, yet in the latter verses it appears to indicate the opposite, that tongues are  sign for believers and prophesy a sign for unbelievers. What did Paul mean when he said this?
I included verse 21 because it seems to indicate that the speaking in foreign tongues like what we see happen at Pentecost is descriptive of how tongues are a sign to unbelievers, naturally a foreigner speaking your tongue will serve as a sign from God. I've heard the interpretation that tongues means two different things in this passage but I don't see that as justifiable since it talking about tongues in such a close proximity without any distinction.

1 Corinthians 14:21-25
21 In the Law it is written, “By people of strange tongues and by the lips of foreigners will I speak to this people, and even then they will not listen to me, says the Lord.” 22 Thus tongues are a sign not for believers but for unbelievers, while prophecy is a sign not for unbelievers but for believers. 23 If, therefore, the whole church comes together and all speak in tongues, and outsiders or unbelievers enter, will they not say that you are out of your minds? 24 But if all prophesy, and an unbeliever or outsider enters, he is convicted by all, he is called to account by all, 25 the secrets of his heart are disclosed, and so, falling on his face, he will worship God and declare that God is really among you.
The context is that tongues are for a few individuals to demonstrate to a group of unbelievers of the same tongue the power of God. It is only a sign to the unbeliever if the unbeliever is of that tongue and can understand it.

(Acts 2:8) And how is it that we hear, each in our own language in which we were born?

But as verse 23 demonstrates, if the whole church comes together and speaks in tongues what benefit is it to anyone? It is highly unlikely the next unbeliever to walk in is of this tongue, unbelievers of all backgrounds could walk in, it may be that no one understands it.

23 ...will they not say that you are out of your minds?

If you read the entire chapter of 14, it becomes even clearer, speaking in tongues to those who do not understand it is of no use.

14 Pursue love, and desire spiritual gifts, but especially that you
may prophesy. 2 For he who speaks in a tongue does not speak to men
but to God, for no one understands him; however, in the spirit he
speaks mysteries. 3 But he who prophesies speaks edification and
exhortation and comfort to men...
18 I thank my God I speak with tongues more than you all; 19 yet in
the church I would rather speak five words with my understanding, that
I may teach others also, than ten thousand words in a tongue.