A district may commence, maintain, intervene in, compromise, and assume the costs of any action or proceeding involving or affecting the ownership or use of waters or water rights within the district used or useful for any purpose of the district or of benefit to any land.