如何获取$ id和匹配数据作为唯一ID检查的结果?

I am trying to make a unique id check for email and phone. I just don't know how to fetch the result... I mean if something (email or phone) already exists then I want to get the details of which data already exists (found/matched) and in which id (like $mail already exist on $id == 2). I need to know the script thanks.

private function isUserExist($mail, $phone){
    $stmt = $this->con->prepare("SELECT id FROM user_data AS t WHERE mail = ? or phone = ?
                                UNION
                                SELECT id FROM emp_data AS u WHERE mail = ? or phone = ?");
    $stmt->bind_param("ssss", $mail, $phone, $mail, $phone);
    $stmt->execute();
    $stmt->store_result();
    return $stmt->num_rows > 0;
}

more: i am going to use it in update script... so if email or phone is found on the id i am currently updating it won't abort update process but if the id is different it will stop update process. and return which data(mail/phone) is already available.

This is my Update script

public function updateUser($name, $surname, $address, $pin, $mail, $phone, $id, $old_mail){
    $stmt = $this->con->prepare("UPDATE `user_data` SET `name` = ?, `surname` = ?, `address` = ?, `pin` = ?, `mail` = ?, `phone` = ? WHERE `user_data`.`id`= ? AND `user_data`.`mail`= ?;");
    $stmt->bind_param("ssssssis", $name, $surname, $address, $pin, $mail, $phone, $id, $old_mail);
    $stmt->execute();
    if (mysqli_affected_rows($this->con) > 0) {
        return 1;
    }else{
        return 2;
    }
}

Fetch results into variable and return it if array is not empty.

    private function isUserExist($mail, $phone){
      $stmt = $this->con->prepare("SELECT id FROM. 
   user_data AS t WHERE mail = ? or phone = ?
                                    UNION
                                    SELECT id FROM emp_data AS u WHERE mail = ? or phone = ?");
       $stmt->bind_param("ssss", $mail, $phone, $mail, $phone);
        $stmt->execute();
    $stmt->store_result();
$res = $stmt->fetch_all();
    if(count($res)===0){
return false;
}
return $res;
}