Invoice Check
There are tow ways to check invoice is created or not.
First
if($order->hasInvoices()):
//do your stuff here
endif;
//do your stuff here
endif;
Second
Shipment Check
There are tow ways to check Shipment is created or not.
First
if($order->hasShipments()):
//do your stuff here
endif;
//do your stuff here
endif;