During past bad relationships, or phases when I was "racking up a number", my work was definitely impaired.
How did I prevent it? I suppose I didn't, but I mostly just worried about being a decent human being to people I know, and not sweating whether casual sweating was immoral.
Side note: once you get to about 30, I don't think anyone talks in terms of your number, and your ability to find a "quality woman" (itself an error-prone reduction of many dimensions to one) will not be changed by even a few score of scores. I sense that your philosophy may lean towards the Christian from your finding consensual casual sex immoral, so your fitness function for quality woman might be way different from mine, and the women who rate highly over that function might actually care about your "number". IMO, if you're still single at 30, no one ought to shocked that your number is well into double digits.