For each state of the automaton $S$, you need to know in advance the set $L(S)$ of possible lengths of suffixes that will accept the word built so far.
I think this set is ultimately periodic, by which I mean that there are lengths $n(S)$ and $t(S)$ such that forall $m \ge 0$, $n(S)+m \in L(S) \iff n(S)+m+t(S) \in L(S)$, which means that you only have to remember precisely the length of $u$ up to $n(S)$ or modulo $t(S)$ to decide if, from state $S$, there is a suffix of the same length as $u$ that accepts the word.
Doing this for every state, pick $n = \max n(S)$ and $t = \text{lcm}\; t(S)$ : you only need to remember the length of $u$ up to $n$ or modulo $t$, independantly of the state you are in.
Now you can write a new automaton who remembers this (finite) information on the length $l$ of $u$ while simulating the original automaton, and accepting $(S,l)$ if and only if $l \in L(S)$
Another (much simpler) way is to make a nondeterministic automaton that simulates the original automaton on $u$ and the automaton going in reverse on $v$, simultaneously, and accepts when it finds two words $(u,v)$ landing on the same state.
The states of the new automaton is a couple of states (one for the $u$ process and one for the $v$ process). Put a transition labeled $a$ from $(q_1,q_2)$ to $(q'_1,q'_2)$ if and only if there is a transition labeled $a$ from $q_1$ to $q'_1$ and there is any transition from $q'_2$ to $q_2$ (in the original automaton). Finally, the initial states are the states of the form $(i,f)$ with initial $i$ and final $f$, and the final states are those of the form $(q,q)$.