WordPress: How to dynamically change sender email and from name within PHP function

I am using the following function to send emails on a WordPress website:

add_action( 'phpmailer_init', 'my_phpmailer_smtp' );
function my_phpmailer_smtp( $phpmailer ) {
    $phpmailer->From = 'Info';
    $phpmailer->FromName = '[email protected]';
}

We are currently building some custom functionality, sending transactional emails from the website. The sender from name/email depends on a few different factors and should dynamically updated.

Now, after setting the default from email and from name like above, how can I dynamically updated these within another PHP function? I have tried calling this phpmailer_init again within our own function, but then the from email and name are just empty. Any help would be appreciated.