Short fragments of dna or rna that are used to alter the function of target RNAs or DNAs to which they hybridize.