Why can I sometimes grip things firmly - but not always?

Muscle spasm. Probably muscle spasm but electrolyte changes and cervical radiculopathy need to be considered.
Weak grip. Intermittent weak grip can be caused by nerve problems, spinal cord problems, or brain problems. Carpal tunnel syndrome is a nerve problem that is probably the most common of all these issues. You should see your doctor for an examination and recommendations.