There is no absolution; there are no clear-cut rules that you can strictly follow and thereby relieve your anxiety. There is only you, doing your best.
Our society heaps so much guilt and shame onto sex and sexuality, but a writer who breaks past that to celebrate and empower their own sexuality can empower their readers to do the same.
The question is how to go about writing characters who aren't like you, not whether you are allowed to.
It's challenging to have the desire to create works that cause minimal harm, paired with the certain knowledge that our writing incorporates our ignorance and erroneous beliefs.
Draw on the best of the way the world is and has been, as well as your most optimistic hopes for what it could be. The real world is very unfair to those on the margins. Use your writing to make up for it.
We're swimming in the narrative conceit that what makes extraordinary characters interesting is their extraordinariness and what makes protagonists interesting is that they're protagonists.