The words persecution and prosecution are both nouns that describe the act of their respective verbs (persecute and prosecute respectively). They also sound pretty similar, though they're definitely not the same.
So let's look at the differences between persecution and prosecution and when to use each.
Persecution vs. Prosecution
Persecution is a noun meaning the condition of being persecuted. So what does persecute mean? Basically, the verb persecute means to harass or annoy someone persistently and with the intent to harm, whether that's physically, psychologically, or a combination of various injuries. So it can get pretty intense on the persecuted side of things.
Individuals can be persecuted, but there are also plenty of examples of whole groups of people being persecuted as well for any number of reasons. Of course, religious beliefs has sparked persecution, but also race, gender, sexual orientation, and political affiliation. Actually, the reasons are nearly limitless.
Prosecution is also a noun and most commonly (though not exclusively) used in relation to the legal system. Prosecution refers either to the act of prosecuting or refers to the party by whom criminal proceedings are conducted. If person A is accused of breaking the law (say running a red light), then the prosecution would be the legal side of the argument that tries to prove person A broke that law.
Prosecute, as a verb, also has non-legal meanings, such as pursuing a course of action until it is completed and/or to perform an activity. So someone could prosecute a long project or prosecute a play (like a handoff in football) in an athletic contest.
Here are a few examples of persecute and prosecute:
Correct: The nomads suffered persecution in nearly every town they visited.
Incorrect (though it could also be correct in some cases): The nomads suffered prosecution in nearly every town they visited.
Correct: The prosecution of the case moved forward with evidence but no witnesses.
Incorrect: The persecution of the case moved forward with evidence but no witnesses.
For some people, prosecution may feel like persecution, but that's not always the case and is usually open to interpretation. Here's one way to keep these two words straight: The "pro" in "prosecution" often refers to the "professional" act of prosecuting a legal case. Meanwhile, the "per" in "persecution" can refer to the "personal" (and possibly legitimate) interpretation of being persecuted.
No matter what type of writing you do, mastering the fundamentals of grammar and mechanics is an important first step to having a successful writing career.