Custom PHP MySQL database queries function - Suggestions for improvement or additions
This monster of a function is hard to use and hard to maintain. Besides, it is bloated with duplicated and/or unnecessary code. Last but not least, the way require &quot;dbconn.script.php&quot;; is called will make your code run slower and make some features (such as transactions) unavailable.
Too many connections
Your current code is connecting to the database every time it runs a query. You shouldn't do that. Always connect strictly  once and then pass a connection variable as a function parameter.
Useless regexp
You already control the return type buy means of $param variable. No need to check the query type manually. It is useless and error prone. What if your query is CALL? SET? REPLACE?
Passing values as array is not that hard.
With your function you have a choice, whether to pass $values as array or not. It makes the code hard to read. At the same time adding two square brackets to your $values is not a big deal. So just just make $values an array mandatory.
Too much tasks for a function
The first question I must ask, why only a single function to perform so many tasks? All right, I can make it you are not familiar with OOP and don't want to use a class (which would be the best solution of course). But why not to make a set of functions, each serving for its own purpose? Why following that horrible practice of procedural mysqli when you have to write a helluvalot of words every time you calling a simple function (mysqli_stmt_get_result($stmt) vs. $stmt-&gt;get_result())?
Here is your intended function call
$rows = mysqli_database_query($sql, $id, &quot;affected_rows&quot;);

compare it with with a code which is shorter but more meaningful and readable at the same time:
$rows = mysqli_delete($sql, [$id]);

A function name should be meaningful and tell you what does this function do. It should be a function name, not a parameter.
In your place I would create a set of functions. Say, a basic one that just performs a query
function mysqli_database_query($conn, $sql, $values, $return_result = true)
{
    $types = $types ?: str_repeat(&quot;s&quot;, count($params));
    $stmt = $conn-&gt;prepare($sql);
    $stmt-&gt;bind_param($types, ...$params);
    $stmt-&gt;execute();
    return ($return_result) ? $stmt-&gt;get_result() : $stmt;
}

and then add some helper functions for various tasks
function mysqli_delete($conn, $sql, $values)
{
    $stmt = mysqli_database_query($conn, $sql, $values, false);
    $return $stmt-&gt;affected_rows();
}
function mysqli_assoc($conn, $sql, $values)
{
    $result = mysqli_database_query($conn, $sql, $values);
    $return $result-&gt;fetch_assoc();
}
function mysqli_all($conn, $sql, $values)
{
    $result = mysqli_database_query($conn, $sql, $values);
    $return $result-&gt;fetch_all(MYSQLI_ASSOC);
}

you can use the following  function instead of that awkward $param = &quot;id&quot; of yours, for any column, not only id. Just select the desired column, i.e. SELECT user_id FROM table ...:
function mysqli_cell($conn, $sql, $values)
{
    $result = mysqli_database_query($conn, $sql, $values);
    $row = $return $result-&gt;fetch_row();
    return ($row) ? $row[0] : false;
}