It worked with the following function. In case anyone need it.
function sanitize_text_with_br($input) {
// Define allowed HTML tags
$allowed_html = array(
'br' => array(),
);
// Sanitize the input while allowing <br> tags
return wp_kses($input, $allowed_html);
}