Hello there,
This parameter is managed by SharePoint administrator. In SharePoint admin center select Policies > Sharing > under Choose expiration and permissions options for Anyone links check the box next to These links must expire within this many days and set the amount.
Users can set an expiration date for the links selecting a file or folder and Share > Edit drop down menu > Link settings > Set expiration date.
The SharePoint administrator also can set guest access to expire in SharePoint admin center > Policies > Sharing > More external sharing settings > Guest access to a site or OneDrive will expire automatically after this many days.
More info here https://support.microsoft.com/en-us/office/video-use-expiration-dates-and-passwords-d4a5a9d9-5cc8-416d-8bb9-90d6c17fd919
Hope this resolves your Query !!
--If the reply is helpful, please Upvote and Accept it as an answer–