Here are the meanings of these words as derived from the NT text and based on the data in BDAG:
ἀπόστολος (apostolos)
of messenger with extraordinary status, especially of God's,
messenger, envoy
This noun is applied to prophets in Luke 11:49, Rev 18:20, Eph 3:5; and Christ Himself in Heb 3:1 but predominantly in the NT of a group of believers with a special function as God's envoys ...
Unlike some of the other NT officers, there is no record of apostles being appointed by the church but only chosen by God/Jesus (Matt 10:2 etc) for the special gifts they receive. Paul was an apostle to the gentiles and thus had to move and travel widely. He established new churches in new areas, a function that today might be called a "missionary".
προφήτης (prophetes)
a person inspired to proclaim or reveal divine will or purpose,
prophet
This term is applied to prophets in the OT (Matt 2:17, etc); John the baptist (Matt 14:5, etc); Jesus Himself (John 4:19, etc); Christians endowed with the spiritual gift of prophecy (Acts 15:32, etc).
Again, prophets were not appointed by the church but chosen directly by God for this special service.
εὐαγγελιστής (euaggelistés)
proclaimer of the gospel, evangelist
The word only occurs in Acts 21:8, Eph 4:11, and 2 Tim 4:5. The fact that both Timothy and Philip are so designated confirms that this and the other titles overlap in their function and work: Philip was one the seven deacons; Timothy was an assistant apostle and pastor.
It is not clear if "evangelist" was a separate title or just a function fulfilled by other people such as pastors, apostles and elders. I am inclined to the latter.
ποιμήν (poimen = shepherd)
one who serves as guardian or leader, shepherd (figuratively) of
those who lead Christian communities/congregations/churches
[Note: our English word "pastor" comes directly from the Latin, "pastor" meaning "shepherd".]
The word is used VERY infrequently in the ecclesiastical sense. It is used of Christ (Heb 13:20, 1, Peter 2:5, see also John 10:2, 11, 11, 12, 14, 16, Mark 14:27, Matt 26:31) and in Eph 4:11. No one in the NT has the title "pastor" and no qualifications are given.
However, the cognate verb is used in Acts 20:28 as a function fulfilled by elders (V17) and in John 21:16 of Peter.
διδάσκαλος (didaskalos = Teacher)
teacher
The word is extremely common and is applied to "teachers of the law" (Luke 2:46, John 3;10), Jesus (Matt 8:19, etc), and an "official" in the Christian church (Acts 13:1, 1 Cor 12:28, Eph 4:11, 2 Tim 1:11, James 3:1, etc). There is no record of who appoints teachers in general apart from our two prominent texts: Eph 4:11 and 1 Cor 12:28 where teachers are appointed by the Holy Spirit Himself!
The material that is taught is spiritual truth as per the apostles' teaching, the prophets' teaching, the message of Scripture, and thus they tell the good news (ie, are evangelists) that help to lead (shepherd) the church. Again, all these functions overlap.
CONCLUSION
As shown above, all these functions overlap somewhat but are ultimately the recipients of God's special spiritual gifts (in some cases more than one!) as taught by Eph 4:11 and 1 Cor 12:28. The purpose of all these spiritual gifts is for strengthening and building up the church.