The precepts are generally considered to be training principles (sikkhapada) which prepare us for more rigorous practice or which generate merit in order to gain a more fortunate rebirth (sugati) in the next life. And by "more fortunate" we definitely mean circumstances in which one meets and can practice the Dharma.
Many Pāḷi suttas outline how sīla (practising the precepts) leads onto more intensive practices such as saṃvara "restraint with the respect to the senses" or indriyesu guttdvara "guarding the doors of the senses". And these in turn lead into more intensive practises like eliminating the hindrances, and then into practising jhāna and vipassanā. Of course in other schools of Buddhism the progression into more intensive practice follows different paths, but on the whole the precepts are seen as preliminary to practising more intensively.
Traditionally for lay people, who do not undertake intensive religious practices, practising the precepts is an important source of merit (puñña) which they hope will accumulate enough to crate a fortunate rebirth next time. Thus traditionally we could say that the precepts protect one from a bad destination (duggati). Traditionally making gifts to monastics and supporting their lifestyle is an important source of merit. Generosity generally is seen as generating merit.
In modern times the distinction between monastics and lay people has begun to break down. Some groups see monasticism as far less important that it has been traditionally, or indeed as irrelevant, and many lay people have now taken up practices traditionally only done by monastics. So it's not always clear how the tradition applies.
On the issue of visiting prostitutes I would say that if one has made a commitment to be faithful to a sexual partner, such as one does in marriage, then visiting a prostitute is clearly a breach of that commitment. It is a lie, and therefore a breach of the precepts.
If one has no such commitment then the situation is more ambiguous. But in order for the act to be completely ethical one would need to know for sure, for example, that the prostitute was not under any compulsion whatever, to do sex work. One would need to be sure that the agreed fee was absolutely fair and that the prostitute received their full share of that money. In my view one could never be certain of these, and thus one would always be risking demerit or apuñña.
As with all the precepts, one must look at the spirit of them as well as the letter. The fundamental principle is "do no harm". One cannot choose to do a harmful action and claim that it is not mentioned in the letter of the precepts. Harm is harm. The institution of prostitution almost always does harm to someone. One can always ask oneself the question: "Would I want my son or daughter to earn their living having sex with strangers for money, risking catching AIDS and so on? Is that what I would want for my children?" My answer to this, despite not having children, is "no".