What is the correlation between this Pasuk and the previous one?
Or ha'Chayim: The previous Pasuk is referring to Teshuvah that they will perform of their own accord; the current one, to Teshuvah that they will perform due to the Tzaros that will befall them. 1
Sha'arei Teshuvah 1:1: Teshuvah is accepted even if one repents due to afflictions, and all the more so if he repents due to fear and love of Hashem .
When is "be'Acharis ha'Yamim" referring to?
Ramban and Seforno: The end of the Pasuk is also 1 reminiscent of the termination of Galus Bavel, 2 when they returned to Hashem, confessed their sins and listened to the Nevi'im 3 - which explains Pasuk 31. 4