I understand that the President signs the blue leather-bound enrolled bill, but it doesn't seem possible that the document could traverse the length of Pennsylvania Avenue in just a few minutes in the case of a last-minute vote. How, then, does the President get bills that must be signed in just a very small period of time?
The US Capitol is really not that far from the White House. They are on the same street, and under two miles apart. It's around an 8-minute drive, according to Google Maps. In cases of dire national emergency where the bill must be signed before midnight (like the Don't Nuke Russia At Midnight Act of 2018), police blocking off traffic and a Secret Service car with sirens blaring could easily make it in under five minutes, at which point it could be run to the President -- easily under 10 minutes for the whole thing.
However, if it's that dire, there's nothing in the Constitution that requires the President to sign laws at the White House. The President is perfectly capable of going over to the Capitol, where he, the Speaker of the House, and the Vice President or president pro tem of the Senate can stand together ready to sign the bill/law. If the enrolled bill must be printed after it's passed (and not pre-printed), the GPO could move a printer into the Capitol (or there's probably at least one already there). The bill could be printed as soon as it's passed, given a quick review by the necessary people, signed by the necessary people (the VP, the Speaker, and the clerk of the house it originated in), and then signed by the President.
There are a few reasons this really isn't a big concern. First, as mentioned, a bill could potentially go from final passage to signing in under five minutes. Second, it's incredibly rare for even a ten or twenty minute delay in a law to be that big a deal. If it would be truly catastrophic for it to not pass, it's much less likely to even get near the deadline; while it might be controversial what the exact bill should say, Congress is generally willing to pass a "things continue like they are now for a short time while we get our act together" stopgap. But almost no federal law is ever so critical that it taking effect twenty minutes after some deadline matters at all.
The President need not be physically present to sign a piece of legislation. In 2013 President Obama used an autopen to sign the legislation averting the fiscal cliff (a package of tax increases and spending cuts set to come into effect due to the expiry of previous legislation). The President was in Hawaii at the time and could not return in time to sign the new legislation before the old legislation expired. This was actually the third time the President had used the autopen to sign legislation remotely.
Although some members of Congress questioned the validity of the signature at the time, the president cited a legal memorandum from the White House Office of Legal Counsel under his predecessor, George W. Bush. The memorandum states:
This memorandum confirms and elaborates upon our earlier advice that the President may sign a bill in this manner. See Memorandum for Alberto R. Gonzales, Counsel to the President, from M. Edward Whelan III, Principal Deputy Assistant Attorney General, Office of Legal Counsel, Re: Signing of H.J. Res. 124 (Nov. 22, 2002) (“Whelan Memorandum”). We emphasize that we are not suggesting that the President may delegate the decision to approve and sign a bill, only that, having made this decision, he may direct a subordinate to affix the President’s signature to the bill.
This procedure has never been challenged in court, so it is possible that it might be declared invalid if it ever came up in a court case. For now, however, the accepted practice is that it is sufficient for a President to direct the Presidential signature to be affixed to a bill, without the President necessarily being personally present.
There's nothing in the Constitution that requires the president's signature to be on the same sheet of paper that was handed around in the House and Senate chambers.
If it is already known in advance that the president intends to sign a given bill, they can prepare the copy that the president signs and have it waiting for Congressional approval. Once that is done, a phone call alerts the president and he signs his copy.
And it goes without saying that the president is briefed on all of the bills that may come before him anytime soon, and his intentions upon receipt of any bill are generally known before the bill has passed both houses of Congress.