Optimal habitat selection by helminths within the host environment