Hello Abid Hussain,
With Microsoft Graph createLink you can create sharable link with password and ExpirationDateTime, and external users can no longer access the file/folder using sharable link after expiration date, but the file/folder will not be deleted from source.
Hope this helps.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".