Add tax to the contract

I want to add the ability to my own token, "taxable," in a way that the "tax" can be variable.
Could you please assist me?
And one more question
How can tax be changed later? Where can we change the tax rate?

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "@openzeppelin/contracts@4.9.3/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts@4.9.3/token/ERC20/extensions/ERC20Burnable.sol";

/// @custom:security-contact info@test.com
contract Test is ERC20, ERC20Burnable {
    constructor() ERC20("Test", "TST") {
        _mint(msg.sender, 1000000000 * 10 ** 10);
    }
}

You can add a tax adding some code inside _transfer() function.
Ex:

uint256 tax = 5;
...
...
...
function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        ...

        uint256 taxAmt = amount * tax / 100;
        _balances[taxRecipient] += taxAmt;
        _balances[recipient] += amount - taxAmt;
     ...
     ...
    }

function setTax(uint256 newTax) external onlyOWner {
   tax = newTax;
}

This is just a raw example hoping you understand