How to get a page url segment on wordpress?

yes, you should be able to call the query var by:

get_query_var('user');

if this does not work, then “user” is not the registered query var. You can debug by dumping $wp_query and pin pointing the var / key.

global $wp_query;