We investigate the length of the longest common substring for encoded sequences and its asymptotic behaviour. The main result is a strong law of large numbers for a re-scaled version of this quantity, which presents an explicit relation with the Rényi entropy of the source. We apply this result to the zero-inflated contamination model and the stochastic scrabble. In the case of dynamical systems, this problem is equivalent to the shortest distance between two observed orbits and its limiting relationship with the correlation dimension of the pushforward measure. An extension to the shortest distance between orbits for random dynamical systems is also provided.keywords: string matching, Rényi entropy, shortest distance, correlation dimension, random dynamical systems, coding MSC: 60F15, 60Axx, 60C05, 37A50, 37A25, 37Hxx, 37C45, 94A17, 68P30