How to remove all special characters from a string with magento 2 as a best practice?

Magento Contains Match.php file they contain CONSTANT like SPECIAL_CHARACTERS and with that constant all the special character are available.
File path is Magento\Framework\Search\Adapter\Mysql\Query\Builder\Match.php

When we need to remove or replace special character with some other character you can use Magento default constant.

Match.php file with a constant declaration like as below,
const SPECIAL_CHARACTERS = ‘-+~/\\<>\'”:*$#@()!,.?`=%&^’;
When we need to modify a string with special character to some custom value or blank you can do as below way,

<?php
 $originalString = "Test1$23?45&789^1";

 $replaceSymbols =  str_split( \Magento\Framework\Search\Adapter\Mysql\Query\Builder\Match::SPECIAL_CHARACTERS, 1);
 $string = str_replace($replaceSymbols, ' ', $originalString));
 echo $string;

The result will be, Replace all special character with one space.
“Test1 23 45 789 1”