SOLUTION:
The problem comes from the fact the constant DS has been removed since Joomla 3.
Most probably a bad porting of modules or templates in Joomla 4 is causing your issue.
Here a quick solution.
1. Enable Debug mode (Global Configutation/System/Debug/Debug System -> Yes)
2. Try to trigger the error again. In Debug Mode Joomla should print the error stacktrace.
3. the first line should be the script that is causing the error. Open it and check whether there is any constant "DS" usage.
4. If there is, add this block on top
if(!defined('DS')){
define('DS',DIRECTORY_SEPARATOR);
}
5. if that doesn't solve, keep inspecting the other scripts in the stacktrace.