what bytes exactly should be removed
Those corresponding to the Segwit data fields:
- segwit flag and marker after the version number (bytes 4-5 with zero-based indexing).
- segwit witness data between final output and lock time
In general you cannot say something like remove bytes 100-166 because the length and number of inputs and outputs is not fixed – so start position varies and must be calculated by parsing the specific inputs and outputs. The number and length of witnesses also varies but the end of witness data (if present) will be 4 bytes before end of transaction data.
See What are the parts of a Bitcoin transaction in segwit format?