This most likely is parse order, however as your trying to get a global into a php variable you can forget about tag parsing completely. Try this :
$uid = ee()->session->userdata('member_id');
Member ID is in the Session class (if logged in), test the group for if_logged_in or not.
FYI, for other global vars, you can do things like this :
//Global Variables (Site Label)
$var = ee()->config->_global_vars['site_label'];
//Global config settings (Base URL)
$var = ee()->config->config['base_url'];
//User variables (alternate method)
$var = ee()->session->userdata['group_id'];