In October, the United Nations, urged by the United States Government, approved the movement of UN forces across the 38th parallel into North Korea in an effort to unify the country under a non-communist government. In spite of warnings issued by the Chinese Government, the United Nations forces moved toward the Yalu River, marking the North Korean border with Manchuria. Discounting the significance of initial Chinese attacks in late October, MacArthur ordered the UNC to launch an offensive, taking the forces to the Yalu. In late November the Chinese attacked in full strength, pushing the UNC in disarray south of the 38th parallel with the communist forces seizing the South Korean capital, Seoul.
In early 1951 the Chinese offensive lost its momentum and the UNC, bolstered by the revitalized 8th U.S. Army led by General Matthew B. Ridgway, retook Seoul and advanced back to the 38th parallel. From July 1951, until the end of hostilities the battle lines remained relatively stable and the conflict became a stalemate. The Truman Administration abandoned plans to reunite North and South Korea and instead decided to pursue limited goals in order to avoid the possible escalation of the conflict into a third world war involving China and the Soviet Union. When General MacArthur publicly challenged the Truman Administration's conduct of the war, the President, "...concluded that...MacArthur is unable to give his wholehearted support to the policies of the United States Government..." and relieved him from command in April 1951, replacing him with General Ridgway.
https://www.eisenhowerlibrary.gov/research/online-documents/korean-war