For standard pasteurized milk, the USDA and FDA generally recommend:

Refrigerated (Opened): Milk should typically be consumed within 7 days of opening for best quality, provided it has been kept at or below 40°F (4°C).

Refrigerated (Unopened): It can often remain safe for 2 to 5 days past the "Sell-By" date.

Frozen: We'd reccomend removing the milk from the glass container first. Milk can be frozen for up to 3 months. While safe indefinitely if kept at 0°F, the quality and texture will degrade significantly after 90 days.

Sources:

https://www.fda.gov/food/guidance-documents-regulatory-information-topic-food-and-dietary-supplements/milk-guidance-documents-regulatory-information

https://www.fsis.usda.gov/food-safety/safe-food-handling-and-preparation/food-safety-basics/food-product-dating#:~:text=A%20%22Best%20if%20Used%20By,is%20not%20a%20safety%20date.