Here's the TL,DR: To make the experience truly unique, this is basically doubling the work. Otherwise it makes things super generic.
Let me start with the story aspect of this then I'll get into the technical aspect. Most game devs have a story in mind for their game and that story is about a particular character be they male or female. Now the more generic the story the more generic the character can be. If the character's gender doesn't play a large role in the story, you can swap it out potentially. The famous example of this in film is Ripley from Alien was intended to be a male role, but Sigourney Weaver won them over. However, I'm guessing that once the decision was made to make Ripley a woman, certain aspects were likely altered.
You would have to write the whole game assuming that the MC is both male and female meaning you can't rely to heavily on that element for story reasons. For example, let's say you have a scene in mind for a bathroom or locker room. That scene takes on a very different context if the MC is male or female as bathrooms and locker rooms are segregated by gender. Seeing another character nude or changing clothes also takes on a very different context based on gender. To avoid having to make two completely different games, you would need scenarios that sort of fit either, which is rather limiting.
Outside of the main character, you could have all the potential conquests be gay or straight as needed by the protagonist, but that fundamentally alters some aspects on those characters. Writing a character as straight or gay is more involved that just who they like to have sex with imo. I guess you could split the difference and make everyone bi, but that's also a bit weird. The easiest way, again, would be to avoid even factoring sexual orientations into the story other than they might like the MC, which makes things more generic.
Now the technical aspects of this. Is it worth the extra effort? Not usually. This probably works best with games using 2D art as the art can often be handled in layers. You'll see the option to change hair/clothes/etc. in 2D games more often because they just display the appropriate sprite layered into the scene accordingly. This can also work in true 3D games like Unity engine where the rendering is done in real-time so the protag is drawn in every scene anyway. In a game that uses static 3D renders, like a lot of the games on here, this means a lot of extra render time.
Speaking to 3D rendered games here. To limit the amount of double rendering, you'd probably make the whole game first person without showing the main character, even their arms. You'd have to make unique sex scenes for both genders because you can't avoid having the MC in those. You could do that style where characters just float in front of a background or you just show their head in dialogues to include the MC more often, but that's less immersive imo. I feel like this would make the MC seem disconnected from the story. They would just be a floating head essentially.
Now if I was dead set on making a game where you could play either gender, I would make the game about those two people getting together. Meaning you could play the game from the guy's perspective or from the girl's perspective. This would let you reuse a lot of work without it seeming weird, because it's the same situation, but from the other person's side of it. So all the sex scenes can involve those two people and they don't need to be done twice. If the game is about their relationship, then most of the dialogue will involve the two of them, so again you can reuse it. You'd probably have a few parts where they do things alone that would be unique to the character being played, but it would limit the amount of extra work needed.
All in all, I don't think this is a viable options for the types of games being made on this site (mostly). If the game was truly unique based on the character being played then you are talking about almost double the work to make one game. You might as well just make two games at that point, realistically. You could have the games be related, in the same universe, using the same characters, but with a different MC. The alternative is a very generic game that is a one-size-fits-all scenario to keep extra work to a minimum. If you are bothering to make a game where you can be either gender, but being either gender doesn't really matter, then what was the point?