I can’t comment on how this incident between Judah and Tamar is perceived within Judaism, other than to direct you to this question https://judaism.stackexchange.com/questions/97351/why-is-it-important-to-stress-the-prostitute-part-of-tamars-plan-regarding-ye
The answer and comments provided by Sabbahillel suggest that it was important to understand that Yehudah (Judah) was acting in a way that was permitted at the time. He believed the woman was a prostitute and so he promised to give her a goat in payment. “Torah has to give the details of the story so we can see what happened. We need to see that it was not just a random woman and that Yehudah had to leave a pledge for payment.”
With regard to one particular Christian view I am aware of, the events as described in Genesis chapter 38 shows that God uses imperfect and flawed humans in the outworking of His divine plans. Nothing is left to chance. The fact that Judah had failed to give Tamar his son Shelah as a husband after she had been widowed meant that she was driven to desperate measures if she was ever to conceive and carry on the family line. Pretending to be a prostitute in order to way-lay Judah had the desired effect, and Tamar became pregnant by Judah and bore twin sons, Perez and Zerah.
The story is recorded in Genesis 38 and provides historical and spiritual information about the Messianic line. Why is this unpleasant story included in Scripture, and why was Tamar granted the privilege of being included in the Messianic line? It may be simply to show us that God’s purpose is accomplished despite man’s unrighteousness. In Hebrews 11 there is a long list of Old Testament people who are commended for their faith, and among them are many sinful people who did dreadful things. But, because they believed God, their faith was credited to them as righteousness (Genesis 15:6). https://www.gotquestions.org/Tamar-Bible.html
More detailed information is contained here, part of which says this:
Judah married a Canaanite woman who gave Judah three sons: Er, Onan, and Shelah. When Er grew up, Judah gave him a wife named Tamar. But Er was an evil man, so the Lord put him to death (verse 7). Following the custom of levirate marriage, Tamar was then given to Onan, who selfishly refused to give Tamar children (verse 9); he was also put to death by the Lord for his actions. Shelah was too young to take a wife, so Judah ordered Tamar to live as a widow in her father’s house (verse 11).
After several years Judah’s own wife died, and he grieved. When he recovered, he travelled to Timnah to oversee to the shearing of his sheep. Tamar, still a widow in spite of the fact that Shelah had grown up, heard that her father-in-law was coming, and she devised a plan. Tamar put on a veil and pretended to be a prostitute on the road to Timnah (Genesis 38:14). The veil hid her identity from Judah, and Judah slept with her. Tamar became pregnant, which had been her goal all along. Three months later, when Judah found out that his supposedly chaste daughter-in-law was pregnant, he was filled with rage: “Bring her out and have her burned to death!” he demanded (verse 24). As she was being brought out for punishment as a harlot, Tamar produced evidence that her pregnancy was due to Judah’s own immorality. Judah saw his hypocrisy and repented, saying, “She is more righteous than I, since I wouldn’t give her to my son Shelah” (verse 26). Judah did not have sexual relations with Tamar after that. She later gave birth to twins, two boys named Perez and Zerah (verses 29–30)...
In spite of all Judah’s faults, his blessing from Jacob was both rich and wonderful; in it, Jacob foretold that Judah’s house would be the greatest, and the scepter, or rule, would not depart from his descendants (see Genesis 49:8–12 for the full blessing). Jacob’s words held true, for, many years later, Judah’s line produced King David and his dynasty and, eventually, through the line of Perez, came the Messiah, Jesus Christ, who is called “the Lion of the tribe of Judah” (Revelation 5:5). https://www.gotquestions.org/Judah-in-the-Bible.html