Most efficient way of identifying the type of org (Production or Sandbox) via Apex code:
Actually we can query this detail from Organization object as below:
SELECT IsSandbox, InstanceName FROM Organization LIMIT 1
On the top of this, we can build our own service method like below:
public static Boolean isSandbox(){ return [SELECT IsSandbox, InstanceName FROM Organization LIMIT 1].IsSandbox; }