Why does it matter if the person in question is a prostitute or not? It's an irrelevant designation.Is having sex with a prostitute as bad as raping her?
You're asking if having sex with someone is as bad as raping him/her.
It's a badly worded question. Rape is a subset of "having sex" so the question becomes redundant.
You need to reword this. Relevant factors would be things like consent, age, competence, &c.
I think that's the point of the question. When you have sex with a prostitute, do you know if these factors are present?
As an example, last week here in Toronto the police busted a large human trafficking ring. They had forced a number of women into prostitution, several of whom were underaged. There are a number of escort agencies in Toronto and the traffickers made websites which looked pretty much exactly the same as the legitimate ones and the customers who used one of these agencies really wouldn't have had much of a way to distinguish between a young woman making a free choice to get a job as a prostitute or a sex slave who's being forced into the business against her consent.
One has to assume that the traffickers, who have far more experience in the matter, would be far more experienced in concealing the sex slaves' lack of consent than the customers would be in discovering it. There didn't seem to be any lack of men having sex with these sex slaves and I have to figure that at least a large subset of those customers would have avoided raping a sex slave if they'd known that this is what they were doing - but they didn't know that.
While there are likely a number of ways to mitigate that risk, when you have sex with a prostitute, you can never really know whether or not she's actually consented to having sex with you.