Hello,
As per my understanding delivery is taking VSBED from sales order.
You can use USEREXIT_SAVE_DOCUMENT_PREPARE" of include MV50AFZ1 to change VSBED based on your custom logic.
You can also refer SAP note 0000415716 which contain details about various exits available during delivery processing and choose the correct exist accordingly.