Stop my Player when he hits the wall without rigidbody

Hi every one. I have a player without a rigidbody but with a collider. I want it to stop when hitting a wall. the wall also has a collider but my player just goes through the wall like its nothing. can somebody help me? thank you.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovment : MonoBehaviour
{
    public float speed = 5f;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow))
        {
            transform.position += transform.forward * Time.deltaTime * speed;
        }
        if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
        {
            transform.position += transform.right * Time.deltaTime * speed;
        }
        if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow))
        {
            transform.position += -transform.forward * Time.deltaTime * speed;
        }
        if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
        {
            transform.position += -transform.right * Time.deltaTime * speed;
        }
        Camera.main.transform.localEulerAngles += new Vector3(-Input.GetAxis("Mouse Y"), Input.GetAxis("Mouse X"), 0);
    }
}

First of all, any moving object with a collider should have a Rigidbody. That tells the physics engine to recalculate it as it moves. You can set it to Kinematic though which makes it not move on its own.
Regardless of if it has a rigibody or not though your code will still move it through a wall because you are manually forcing the position each frame. You have two options. 1) instead of setting the transform.position when you press a key, set a rigidbodies velocity. Then the rigidbody will calculate the collisions for you and not move through objects. 2) write your own physics to detect a wall (harder). There are a lot of tutorials on stuff like this if you want to go down that road. Here is a Unity sponsored one: Recorded Video Session: 2D Platformer Character Controller - Unity Learn