Electronic and photonic reactive collisions in edge fusion plasma and interstellar space: Application to H-2 and BeH systems