Our gemara on Amud Beis discusses the concept of עֵד זוֹמֵם חִידּוּשׁ - the disqualification of conspiring witnesses is a Torah decree, without specific apparent logic. This means that in Torah law, if two sets of two witnesses contradict each other, it is a stalemate, with no set believed more than the other. Yet, if one set disqualifies the other’s testimony by stating, “How can you claim to have seen Plony on that day, when we saw you elsewhere in a far away location.” This testimony not only invalidates the witnesses, but they are punished by a requirement to pay what they originally sought to obligate Plony. Thus, if they testified that Plony borrowed $1,000 on such and such a day, and they were proven as lying by dint of the fact that they were in a different location at said time, they will have to pay $1,000 to Plony . The same would apply to false testimony that Plony murdered someone. The false witnesses would be put to death. This is based on the verse in Devarim (19:19):
וַעֲשִׂ֣יתֶם ל֔וֹ כַּאֲשֶׁ֥ר זָמַ֖ם לַעֲשׂ֣וֹת לְאָחִ֑יו וּבִֽעַרְתָּ֥ הָרָ֖ע מִקִּרְבֶּֽךָ׃
You are to do to [each of] them as he conspired to do to his brother, and eliminate the evil from among you;
This is considered as not an obviously logical judgment, as ultimately it still is the word of two witnesses against two witnesses.
Sefer Yereim (178 or 243, depending on your version) asks a “bomb” kashe. The assumed practice is that the witnesses pay the punishment to the victim. Yet, in other situations where the Torah metes out a fine, except when specified, it goes to Bais Din to use as they see fit. For example, Mishna Terumos (6:2) says that if a non-cohen eats Terumah by accident, one pays the principal to the Cohen owner of the Terumah, but the ⅕ fine is paid to any cohen. Here too, since the punishment levied on the false witnesses is a fine, they should pay the fine to Bais Din or another worthy recipient but not specifically Plony .
Sefer Daf al Daf quotes a teaching attributed to Rav Yisrael Salanter, that when the witnesses have to cough up the payment specifically to the person whom they sought to damage, the pain of the punishment is much worse. While this may be true, it does not yet explain why or from where we see the Torah exacted this punishment on these false witnesses. I will add, I believe Rav Yisrael meant as follows. Since the Torah decreed “do to [each of] them as he conspired to do to his brother”, we try to enact the same pain back upon the witnesses. To testify falsely imputing another person is a highly personal and painful experience. Being falsely accused is disorienting, painful and humiliating. Though an overused phrase, gaslighting is an appropriate description for the experience. Therefore, the witnesses must suffer specifically by giving the fine to Plony, and feel the pain of suffering, and restoring what they sought to inflict.