This will return whether a guid is a player..
tonumber(sourceGUID:sub(5,5), 16) % 8 == 0
You could probably get away with just this:
sourceGUID:sub(5,5) == '8'
You can use this to test it in-game..
Lua Code:
/run print((UnitGUID('target')):sub(5,5) == '8')