AとBでは、前者は~、後者は~ Aと B。前者は~、後者は~
前者は (the former) and 後者は (the latter) are used to refer back to two items, people, or ideas that have already been mentioned, distinguishing between the first and the second. They function similarly to "the former" and "the latter" in English and are used in written language, formal speech, essays, and explanations.
ぜんしゃ前者 refers to the **first** of the two things mentioned, and こうしゃ後者 refers to the **second**.These words are used when comparing or contrasting two things that were introduced in the previous sentence or clause. They help avoid repetition and make writing more concise.
You do not always need to use both together – it is possible to use just ぜんしゃ前者 or just こうしゃ後者 when you only need to highlight one of the two.