Best practice guidance

I need to create a task that must be completed by a certain date and time, and that can be completed over a total duration that is not the actual work time required. For example, I have a task that will take two days, but the timeframe in which it can be done is anytime in the two week period before it is due. If I set the work time for two weeks, my budget is wrong, and if I set the work time at two days, other tasks get moved and bumped in the timeline because of dependencies. I’m sure that there is best practice for this and would appreciate some guidance. Thank you.