There are two ways.
No.1: You can write /sessionheads in chat.
No.2: You can bind it to something in settings, follow this procedure
Settings > Keybindings > FiveM > then look for rpuk_playerid something like that and bind it to some random key on your keyboard, when you press that key it will show the person's session id.
Keep in mind that it has a cooldown when you click it and do not call out someone's id if you see them breaking rules because it will be a rulebreak itself.
I.e "Id 200 it's not allowed do not do that or saying ID 200 come here to me what's your name?"