Basically you need to look at this https://codex.wordpress.org/AJAX_in_Plugins
When you enqueue the script you do it something like this, please note that this is only an example of the values that will be used. You should really look at the document and read about getting the admim ajax url and all of that
wp_enqueue_style('your-handle', '/wp-admin/admin-ajax.php?action=my_custom_css_action');
Then you create an action functin that outputs your dynamic php stylesheet.