Resistance genes are segments of DNA that encode proteins or other molecules that enable cells to withstand harmful agents. These genes can be found in both prokaryotic and eukaryotic organisms, where they often play a role in survival and adaptation. In pathogenic bacteria, for example, resistance genes allow them to survive exposure to antibiotics.