3d platform character moves through objects

Need Unity help. Working on greylevel 3D street. Have some cubes using as placeholders for automobiles. My player can walk through them if I hold a “move” key. When I let go, player moves outside of automobile. What am I doing wrong?

probably you moving player without physics like transform.position and change it every frame ,if you replace it to move using velocity then it will calculate physics stuff and will collide.
using Rigidbody.AddForce(new Vector3()) or Rigidbody.velocity = new Vector3().

So I updated my code to

if ((Input.GetKey(KeyCode.UpArrow)) || (Input.GetKey(KeyCode.W)))
{
Vector3 GLC = transform.TransformDirection(Vector3.forward);
if (!(Physics.Raycast(transform.position, GLC, .5f)))
{
transform.position += Vector3.forward * Time.deltaTime * Speed;
}
}

this has fixed the situation at the moment. basically had to use a raycast for all 4 directions. thanks for all the help!!
@Ronelo