In this study, a two-dimensional model of the contact problem has been examined using the finite element method (FEM) based software ANSYS and based on the multilayer perceptron (MLP), an artificial neural network (ANN). For this purpose, a functionally graded (FG) half-infinite layer (HIL) with a crack pressed by means of two rigid blocks has been solved using FEM. Mass forces and friction are neglected in the solution. Since the problem is analyzed for the plane state, the thickness along the z-axis direction is taken as a unit. To check the accuracy of the contact problem model the results are compared with a study in the literature. In addition, ANSYS and MLP results are compared using Root Mean Square Error (RMSE) and coefficient of determination (R2), and good agreement is found. Numerical solutions are made by considering different values of external load, the width of blocks, crack depth, and material properties. The stresses on the contact surfaces between the blocks and the FG HIL are examined for these values, and the results are presented. Consequently, it is concluded that the considered non-dimensional quantities have a noteworthy influence on the contact stress distributions, and also, FEM and ANN can be efficient alternative methods to time-consuming analytical solutions if used correctly.