Why is a mollusca's (Gastropods' mostly) anus right above the gills? Isn't that, maybe, harmful or somthing?

The arrangement doesn't seem ideal!

In fact evolution has resulted in numerous non-ideal arrangements in lots of species. The charactersistics we see in species are not designed, but are instead the result of evolutionary processes. The processes tend to optimise the organism for passing on genes to the next generation but come with the baggage of their evolutionary history. Evolutionary developments come about by small incremental changes and the result of each small change must be viable. So, the arrangement you describe may be harmful, but fixing it would cause greater problems.

This process has been compared to the development of an old city like London. In an "ideal world" it would make sense to arrange the different districts neatly in rows to efficiently place subway lines and roads, but the districts were in place a long time before the train (or car) was invented. You can't just move these districts around to make the subway and roads line up better.

Good examples include the vertabrate (incl. human) eye, which has an unnecessary blind spot, our inability to synthesise vitamin C, the fact that whales/dolphins cannot breathe under water and so on...

Some examples in humans here: http://www.smithsonianmag.com/science-n … -72743121/
And more generally here: https://en.wikipedia.org/wiki/Argument_from_poor_design