Updated to fix my first answer
(I had some lingering definitions that misled me to thinking my first answer worked. Here's an update that should work)
I think it would be better to include the independent variable explicitly in your function. For example:
h[m_, x_, u_, v_] := With[{g = Function[x, m]}, g[u]+g[v]]
(The above definition gets a benign syntax warning about repeated symbols in a nested scoping construct. If this bothers you, you can use the equivalent alternative):
h[m_, x_, u_, v_] := With[{g = Function @@ Hold[x, m]}, g[u] + g[v]]
Then:
h[3x - 2, x, 2, 3]
11
On the other hand, we can repair your method by using Activate
and Inactive
to get around the lexical renaming that happens with SetDelayed
:
h[m_, u_, v_] := Module[{g},
Activate @ Inactive[SetDelayed][g[x_],m];
g[u]+g[v]
]
Then:
h[3x - 2, 2, 3]
11