Is it true that it's better to have sexual relations with a whore than it is to masturbate? Some people refer to it as, "better in a whore than on the floor." As a kid, I was taught that it would be better for me to masturbate than to have sex with a girl because it may produce a kid. I know it's safer to masturbate but to God which is better?
If two things are sinful, then it makes no sense to rate which sin is "better" because all sins lead to eternal punishment.
Sex with a prostitute is fornication (or adultery if you are married), which is always sinful. "Do you not know that the unrighteous will not inherit the kingdom of God? Do not be deceived. Neither fornicators, nor idolaters, nor adulterers, nor homosexuals, nor sodomites, nor thieves, nor covetous, nor drunkards, nor revilers, nor extortioners will inherit the kingdom of God" (I Corinthians 6:9-10). A bit further Paul also said, "Do you not know that your bodies are members of Christ? Shall I then take the members of Christ and make them members of a harlot? Certainly not!" (I Corinthians 6:15).
Masturbation isn't directly condemned in the Bible. Usually, it is condemned because of what is associated with masturbation: pornography and lustful thoughts. Pornography and lust are condemned as sins. "For this is the will of God, your sanctification: that you should abstain from sexual immorality; that each of you should know how to possess his own vessel in sanctification and honor, not in passion of lust, like the Gentiles who do not know God" (I Thessalonians 4:3-5). For more details see: Is masturbation sinful or not?