Before answering this question let me share what Barnes says on Deut 23:18,
Another Gentile practice, connected with the one alluded to in the
preceding verse, is here forbidden. The word "dog" is figurative
(compare Revelation 22:15), and equivalent to the "sodomite" of the
verse preceding.
With this understanding, some versions more helpfully translate this verse as follows:
- NIV: You must not bring the earnings of a female prostitute or of a male prostitute into the house of the LORD your God to pay any vow, because the LORD your God detests them both.
- BSB: You must not bring the wages of a prostitute, whether female or male, into the house of the LORD your God to fulfill any vow, because both are detestable to the LORD your God.
- CSB: Do not bring a female prostitute's wages or a male prostitute's earnings into the house of the LORD your God to fulfill any vow, because both are detestable to the LORD your God.
Thus, the verse says that money earned from prostitution, whether from a female or male prostitute, is prohibited from the temple as payment for a vow. That is, if one could not afford to pay the promised amount for a vow, it is effectively illegal to earn the money by prostitution.