Clear[PrimDispersion]
PrimDispersion[q_, r_, k_] := 
      Module[{s, t, n, a, b, c, d, j}, 
s = 
          Collect[q, k]; 
t = 
          Collect[r, k]; 
n = 
          Exponent[s, k]; 
If[
          n === 0  ||  Not[n == Exponent[t, k]], 
          Return[{}]]; 
a = 
          Coefficient[s, k, n]; 
b = 
          Coefficient[s, k, n - 1]; 
c = 
          Coefficient[t, k, n]; 
d = 
          Coefficient[t, k, n - 1]; 
j = 
          Together[(b*c - a*d)/(a*c*n)]; 
If[
          Not[IntegerQ[j] &&  j ≥ 0], 
          Return[{}]]; 
If[
          Together[c*s - a*(t /. k -> k + j)] === 0, Return[{j}], 
          Return[{}]]
]

PrimDispersion[k, k - 1234, k]

q = Expand[3  (k^2) + m k - 5  m + 1 /. k -> k + 4321]

r = Expand[n (3  (k^2) + m k - 5  m + 1)]

PrimDispersion[q, r, k]

Clear[DispersionsMenge]
DispersionsMenge[q_, r_, k_] := 
      Module[{f, g, m, n, i, j, result, tmp, op1, 
          op2}, 
f = Factor[q]; 
g = 
          Factor[r]; 
If[Not[Head[f] === Times], m = 1, 
          m = Length[f]]; 
If[Not[Head[g] === Times], 
          n = 1, n = 
            Length[g]]; 
result = {}; 
Do[
If[Head[f] === Times, 
            op1 = f[[i]], op1 = f]; 
If[
            Head[op1] === Power, 
            op1 = op1[[1]]]; 
Do[
If[
              Head[g] === Times, op2 = g[[j]], 
              op2 = g]; 
If[Head[op2] === Power, 
              op2 = op2[[1]]]; 
tmp = 
              PrimDispersion[op1, op2, k]; 
If[
              Not[tmp === {}], 
              AppendTo[result, tmp[[1]]]], 
{j, 1, 
              n}], 
{i, 1, m}]; 
Union[
          result]
]

DispersionsMenge[(k^2) (k + 4), k (((k - 3))^3), k]

q = 
      Expand[k (3  (k^2) + a) (k - 22536) ((k^3) + a)]

r = 
      Expand[k (3  (k^2) + a) (k - 22536) ((k^3) + a) /. {k -> 
              k - 345}]

DispersionsMenge[q, r, k]