The Nikon D5 can only shoot 3 minutes of 4k video while the D500 can shoot 4k for 30 minutes (see this and this post for more details). I received a tip that Nikon will release a firmware update after shipping starts in March that will increase the 4k recording limit of the D5 to 30 minutes. This info is coming from a Nikon rep at one of the recent D5 events, so take it with a grain of salt.
Update: the 30 min 4k video in the D5 will probably be achieved by recording 10 sequential files @ 3 minutes each.